RE: RECORD vs POINTER TO RECORD

From: [at]} <Mary>
Date: Wed, 23 Aug 2000 10:38:51 +1000 (EST)

Hi,

sorry I didn't make myself clear. I originally defined my model as
follows:

TYPE
        Name* = ARRAY 12 OF CHAR;
                
        Coord* = RECORD (Stores.Store)
                l*, t*, r*, b*: INTEGER;
        END;

        XYCoord* = POINTER TO RECORD (Models.Model)
                name*: Name;
                x*, y*: INTEGER;
                next*: XYCoord
        END;
                
        Predictor* = RECORD
                name* : ARRAY 32 OF CHAR;
                predtype*: INTEGER;
                rangefrom*, rangeto*: REAL;
                rangelevels*: INTEGER;
                optcont*: REAL ;
        END;
        
        Model* = POINTER TO RECORD (Models.Model)
                predictors*: Predictor;
                rank*, unsuitable*: XYCoord;
                labels*, medians*, ass1*: XYCoord;
                prev*, next*: Model
        END;

        MoveOperation = POINTER TO RECORD (Stores.Operation)
                dy: INTEGER; (*Change vertical component. Left
and right do not change.*)
                model: Model;
                fig: XYCoord
        END;

        NameOperation = POINTER TO RECORD (Stores.Operation)
                newname: Name; (*Change name of
(rank) variable....would work for any XYCoord*)
                model: Model;
                rank: XYCoord
        END;

        UpdateMsg* = RECORD (Models.UpdateMsg)
                y*: INTEGER
        END;

        UpdateNameMsg* = RECORD (Models.UpdateMsg)
                name*: Name
        END;
                
VAR
        interactor*: Predictor;
        header*, current*: Model; (* header (or root) and current elements
of doubly-linked ring *)
        location: Files.Locator;
        filename: Files.Name;
        bg* (*background coordinates*): Coord;
        optmedian*, optquartiles*(*assessment when ALL variables and
factors at optimum*): XYCoord;

With the model defined this way I can only have have one instance of the
model running as it requires the VAR interactor, header, current etc (and
I am also having trouble with PropogateDomain- , so I can't cut/copy and
paste the views associated with this model). So I want to redefine the
model so it incorporates ALL the necessary variables and use it as a
class. I have tried to do this like this:

Figure* = POINTER TO RECORD (Stores.Store)
        name*: Name;
        x*, y*: INTEGER;
        next*: Figure
END;
                
Predictor* = POINTER TO RECORD (Stores.Store)
        name* : ARRAY 32 OF CHAR;
        predtype*: INTEGER;
        rangefrom*, rangeto*: REAL;
        rangelevels*: INTEGER;
        optcont*: REAL ;
        rank*, unsuitable*: Figure;
        labels*, medians*, ass1*, ass2*, ass3*: Figure;
        prev*, next*: Predictor
END;
        
Model* = RECORD (Models.Model)
        current*, header* : Predictor;
        bg*: Coord; (*background coordinates*)
        optmedian*, optquartiles*: Figure (*assessmentwhen ALL variables and factors at optimum*)
END;

I wanted to define the model as a RECORD not a POINTER TO RECORD becuase I
can't call a pointer by reference in the receiver of a method. Is this
possible? If its not, the procedures that operate on the data cannot be
methods of the class?

sorry for the lengthy email, I would be very appreciative of any advice.

regards,
Mary Kynn.

On Tue, 22 Aug 2000, Bengt Johansson wrote:

>
> Hi Mary,
>
> We don't fully understand what you would like to do. However, the ObxLines
> example might be helpful to you. In this example there is a model which
> contains a linked list of lines. The definition of these datatypes looks
> like this:
>
> Line = POINTER TO RECORD
> next: Line;
> x0, y0, x1, y1: INTEGER
> END;
>
> Model = POINTER TO RECORD (Models.Model)
> lines: Line
> END;
>
> And internalize for this model is defined this way:
>
> PROCEDURE (m: Model) Internalize (VAR rd: Stores.Reader);
>
> For pointer types, "VAR" is not needed in method definitions. It's the
> contets of the model that will be changed, not the model pointer.
>
> If this doesn't help to solve your problem, then maybe you can describe your
> problem more in detail or send us your program.
>
> Regards,
> Bengt, Oberon microsystems inc.
>
>
> > -----Original Message-----
> > From: Mary Kynn [mailto:m.kynn{([at]})nowhere.xy
> > Sent: Dienstag, 22. August 2000 06:27
> > To: blackbox{([at]})nowhere.xy
> > Subject: RECORD vs POINTER TO RECORD
> >
> >

> > When I define
> >
> > Model = RECORD (Models.Model)
> > etc
> >
> > instead of
> >
> > Model = POINTER TO RECORD (Models.Model)
> > etc
> >
> > and then try to define the internalize/externalize etc
> > PROCEDURE (VAR m: Model) Internalize- (VAR rd: Stores.Reader)X;
> >
> > I get the error message (at X) that the parameter doesn't match (there
> > may be other errors as well in defining the Model this way)

> >
> > I have tried to define the model as a record because the model contains
> > linked lists (which I want to alter within methods) and cannot call a
> > pointer by reference in the receiver of methods.

> >
> > Can anyone help me with this?
> >
> > regards,
> > Mary Kynn
> >
> > School of Mathematical Sciences
> > Queensland University of Technology
> > Australia
> >
> > --------------------------------------------
> >
> > To unsubscribe from this mailing list, send a message containing
> > the word "unsubscribe" to:
> > blackbox-request{([at]})nowhere.xy
> >
> > To get a list of valid e-mail commands and instructions on their
> > usage, send a message containing the word "help" to the above address.
> >
> > Send any problem reports or questions related to this email list
> > to the list owner at
> > owner-blackbox{([at]})nowhere.xy
> >
>
> --------------------------------------------
>
> To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
> blackbox-request{([at]})nowhere.xy
>
> To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
>
> Send any problem reports or questions related to this email list to the list owner at
> owner-blackbox{([at]})nowhere.xy
>

--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
\,
Received on Wed Aug 23 2000 - 00:38:51 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:45 UTC