Re: Question: storing a record to a file

From: René A. Krywult <"René>
Date: Mon, 14 Jul 2003 22:21:40 +0200

----boundary-LibPST-iamunique-223893769_-_-
Content-type: text/plain

Now this is interesting. Is there a logical reason why

ptyp^ := typ;

where ptyp = POINTER TO typ and
typ = EXTENSIBLE RECORD
END;
is an incompatible assignment? OR could it be that the compiler tries to interprete ptyp^ and ptyp alike (because they have been made exchangeable in many instances), which is ok for something like ptyp.field being the shortcut for ptyp^.field,
but which seems to be really bad where one tries to fill the dereferenced record with data?

Rene

Wojtek Skulski wrote:

> Hi:
>
> here is the more elaborate version, which however does not
> compile. I am not sure how to follow this line, but I will
> think of it. Thank you for the suggestion.
>
> MODULE Test;
> IMPORT Dialog, Stores, Files;
> TYPE
> PersistentTree* = EXTENSIBLE RECORD (Stores.Store)
> tree*: Dialog.Tree
> END;
>
> PPT* = POINTER TO PersistentTree;
>
> VAR
> wr: Stores.Writer;
> file: Files.File;
> mainTree: PersistentTree;
> ppt : PPT;
>
> BEGIN
> wr.ConnectTo (file);
> NEW(ppt);
> (*the following does not compile*)
> ppt^ := mainTree;
> wr.WriteStore (ppt);
>
> END Test.
>
> Wojtek Skulski skulski{([at]})nowhere.xy
> On Mon, 14 Jul 2003, [iso-8859-1] René A.Krywult wrote:
>
> > Wojtek,
> >
> > I didn't try the following, but what about something like this:
> >
> > TYPE
> > PersistentTree* = EXTENSIBLE RECORD (Stores.Store)
> > tree*: Dialog.Tree
> > END;
> >
> > PPT*=POINTER TO PersistentTree;
> >
> > VAR
> > wr: Stores.Writer;
> > file: Files.File;
> > mainTree: PersistentTree;
> > ppt:PPT;
> >
> > (*the following does not compile*)
> > wr.ConnectTo (file);
> > NEW(ppt);
> > ppt^=mainTree;
> > wr.WriteStore (ppt);
> >
> > Rene
> >
> >
> >
> > Wojtek Skulski wrote:
> >
> > > Hi:
> > >
> > > does anybody know how can I store a record to a file?
> > > Not a pointer to record, but a record. Specifically:
> > >
> > > TYPE
> > > PersistentTree* = EXTENSIBLE RECORD (Stores.Store)
> > > tree*: Dialog.Tree
> > > END;
> > >
> > > VAR
> > > wr: Stores.Writer;
> > > file: Files.File;
> > > mainTree: PersistentTree;
> > >
> > > (*the following does not compile*)
> > > wr.ConnectTo (file);
> > > wr.WriteStore (mainTree); (* here pointer is expected*)
> > >
> > > So, how can I write the record to the file?
> > >
> > > Or, am I looking in the wrong direction? Maybe there is
> > > some method or procedure somewhere which can take a record,
> > > not a pointer?
> > >
> > > Or, perhaps there is a conversion procedure somewhere
> > >
> > > GetPointerToRecord (rec: ANYREC): ANYPTR;
> > >
> > > I know I can use SYSTEM.ADR to get the address of the variable,
> > > but this is the last resort. Any better ideas, anyone?
> > >
> > > Please e-mail me, I am still subscribed only for the weekly
> > > digests, I jknow I should change this.
> > >
> > > Thank you.
> > >
> > > Wojtek Skulski skulski{([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
> > >
> > > Current posting policy:
> > >
> > > a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
> > >
> > > b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
> >
> >
> >

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

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

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-223893769_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBOb3cgdGhpcyBpcyBpbnRlcmVz
dGluZy4gSXMgdGhlcmUgYSBsb2dpY2FsIHJlYXNvbiB3aHlccGFyDQpccGFyDQpwdHlwXiA6PSB0
eXA7XHBhcg0KXHBhcg0Kd2hlcmUgcHR5cCA9IFBPSU5URVIgVE8gdHlwIGFuZFxwYXINCnR5cCA9
IEVYVEVOU0lCTEUgUkVDT1JEXHBhcg0KRU5EO1xwYXINCmlzIGFuIGluY29tcGF0aWJsZSBhc3Np
Z25tZW50PyBPUiBjb3VsZCBpdCBiZSB0aGF0IHRoZSBjb21waWxlciB0cmllcyB0byBpbnRlcnBy
ZXRlIHB0eXBeIGFuZCBwdHlwIGFsaWtlIChiZWNhdXNlIHRoZXkgaGF2ZSBiZWVuIG1hZGUgZXhj
aGFuZ2VhYmxlIGluIG1hbnkgaW5zdGFuY2VzKSwgd2hpY2ggaXMgb2sgZm9yIHNvbWV0aGluZyBs
aWtlIHB0eXAuZmllbGQgYmVpbmcgdGhlIHNob3J0Y3V0IGZvciBwdHlwXi5maWVsZCxccGFyDQpi
dXQgd2hpY2ggc2VlbXMgdG8gYmU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3aWxs
IHJlY29nbml6ZSB5b3UgYXMgc3Vic2NyaWJlciBhbmQgZm9yd2FyZCB5b3VyIHBvc3RpbmcgaW1t
ZWRpYXRlbHksIHdpdGhvdXQgY3JlYXRpbmcgYW55IG92ZXJoZWFkLlxwYXINClxwYXINCmIpIElm
LCBmb3Igc29tZSByZWFzb24sIHlvdSBjYW5ub3QgcG9zdCBmcm9tIHRoZSBhZGRyZXNzLCBieSB3
aGljaCB5b3UgYXJlIHN1YnNjcmliZWQsIHlvdXIgbWVzc2FnZSB3aWxsIGJlIG1vZGVyYXRlZCB0
byBhdm9pZCBzcGFtLiBQbGVhc2UgdW5kZXJzdGFuZCB0aGF0IG1vZGVyYXRpb24gd2lsbCBvZnRl
biBjYXVzZSBzb21lIGRlbGF5LCBpbiBwYXJ0aWN1bGFyIG92ZXIgd2Vla2VuZHMgb3IgaG9seWRh
eXMuXHBhcg0KfQ=


----boundary-LibPST-iamunique-223893769_-_---
Received on Mon Jul 14 2003 - 22:21:40 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:08 UTC