Thread View: comp.lang.modula2
4 messages
4 total messages
Started by Satpal Chander
Wed, 06 Mar 1996 16:54
****HELP POINTER TO A SET *****
Author: Satpal Chander
Date: Wed, 06 Mar 1996 16:54
Date: Wed, 06 Mar 1996 16:54
27 lines
1198 bytes
1198 bytes
---BEGIN PGP PUBLIC KEY BLOCK----- Version: 2.6.2 mQCNAjD72DoAAAEEALiqfWHp1awcXl4o7WEDY+t0BNQbla5EgRcG0cJ7F0cF3QZ/ u6G/nqw1wq/kTpes7y+EGUGoePc3YV9s8Rb9RS/rO6dtQ+Jv+P9lFWNTIZ7f5jbz aMWMDMtepvZoTwIJq5RfhqqKNHluQWe65I7gkXL18wA7yB40PktvTIfUCiCFAAUR tCZTYXRwYWwgQ2hhbmRlciBjOTUwMjAwN0B6ZXVzLmh1ZC5hYy51aw== =rbna -----END PGP PUBLIC KEY BLOCK----- I need to knoiw how to decode a pointer to a set eg set_ptr = pointer to my_set my_set = (hello,there,how,are,you) How do I decode the set_ptr;-(( How do do and assignment to it;-(( How do you exit a program in M2. Imean just exit the program totally from anywhere within it??? Thanx In Advance SATPAL CHANDER The Truth Is Within Huddersfield University England
Re: ****HELP POINTER TO A SET *****
Author: "Mark Morgan Lloyd "
Date: Wed, 06 Mar 1996 20:03
Date: Wed, 06 Mar 1996 20:03
31 lines
1573 bytes
1573 bytes
> I need to knoiw how to decode a pointer to a set eg > set_ptr = pointer to my_set > my_set = (hello,there,how,are,you) Tidy this up before coming back asking for more help :-) > How do I decode the set_ptr;-(( The only permissible operations on a pointer are dereference, assignment, and comparison for equality/inequality. What are you trying to do? > How do do and assignment to it;-(( To the pointer or to the entity it is pointing to? > How do you exit a program in M2. Imean just exit the program totally > from anywhere within it??? HALT, but be warned that some implementations treat this as an abnormal termination and produce a memory dump or whatever, also don't assume that files will be closed properly. The "right" way to do it depends very much on what you are trying to do, you are likely to lose marks if you are not _very_ careful since some academics consider RETURN and EXIT to be equivalent to GOTO and I am sure that they would also have included HALT if they could have brought themselves to use the word in public. Mark Morgan Lloyd mark_tbu@cix.compulink.co.uk [Opinions above are the author's, not those of his employers or colleagues]
Re: ****HELP POINTER TO A SET *****
Author: Peter Moylan
Date: Thu, 07 Mar 1996 04:02
Date: Thu, 07 Mar 1996 04:02
48 lines
2164 bytes
2164 bytes
Satpal Chander (c9502007@zeus.hud.ac.uk) wrote:
>I need to knoiw how to decode a pointer to a set eg
>set_ptr = pointer to my_set
>my_set = (hello,there,how,are,you)
TYPE
MyType = (hello, there, how, are, you);
SetPtr = POINTER TO MySet;
MySet = SET OF MyType;
VAR
x: MyType; y: MySet; p: SetPtr;
BEGIN
x := hello;
y := MySet {there, are};
NEW (p);
p^ := MySet {hello, you};
y := p^;
p^ := p^ + x;
(* and so on *)
From some ambiguities in your question, it's not clear whether
you need a point to a set or a pointer to an enumerated type.
Before using any of this, you need to have a clear picture of
which types you really do need.
>How do you exit a program in M2. Imean just exit the program totally
>from anywhere within it???
From vague memory, I think it's the HALT statement. The reason
my memory of this vague is that, in years of Modula-2 programming,
I've never found any use for this statement. Giving up a job
in the middle is sloppy programming practice. You'll get a more
professional-looking result if the program closes down gracefully;
and that includes a provision for anyone reading the code to
be able to see that it's closing down gracefully. In my opinion,
that means that any procedure that needs to fail should do so
by returning an error code to the caller, rather than simply
collapsing.
--
Peter Moylan peter@ee.newcastle.edu.au
http://www.eng.newcastle.edu.au/ee/Moylan.html
OS/2 freeware list at
http://www.eng.newcastle.edu.au/ee/Moylan/os2/os2info.html
Re: ****HELP POINTER TO A SET *****
Author: Simon Shanks
Date: Mon, 11 Mar 1996 23:53
Date: Mon, 11 Mar 1996 23:53
8 lines
667 bytes
667 bytes
Satpal Chander <c9502007@zeus.hud.ac.uk> wrote: >How do you exit a program in M2. Imean just exit the program totally >from anywhere within it??? Using such things as a HALT command. I think this is what you need. Later, ~Simon~
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads