[comp.lang.forth] regular vs. user variables

thomson@udel.EDU (Richard Thomson) (07/28/87)

I have seen two 'uses' of variables in the FORTH system that I have (MultiFORTH
for the Amiga from Creative Solutions).  The first seems to be your run-of-the-
mill variable:

Variable Foo	( declare a variable )

The other is a 'user' variable declared (I *think*) as follows:

240 user <value> !	( store <value> in user variable #240 )

What's the difference between normal variables and user variables?  Why are user
variables limited to a certain number? (about 60, I think?)  Does this have
something to do with the run-time kernel of my FORTH?

Thanks in advance.				Rich Thomson

oster@dewey.soe.berkeley.edu (David Phillip Oster) (07/29/87)

In article <399@louie.udel.EDU> thomson@udel.EDU (Richard Thomson) writes:
>What's the difference between normal variables and user variables?  Why are user
>variables limited to a certain number? (about 60, I think?)  Does this have
>something to do with the run-time kernel of my FORTH?

User variables are really fields in a record pointed to by a "user pointer".
Since they are fields in a record, the number of them is limited by the
size you ALLOT to hold the records.

They are for multi-tasking. It is common for each forth task to have its
own input port (access to the keyboard) and output port, (window). So, key
and emit are often indirected through the user pointer.

They are not part of the standard, so your mileage may vary.


--- David Phillip Oster            --My Good News: "I'm a perfectionist."
Arpa: oster@dewey.soe.berkeley.edu --My Bad News: "I don't charge by the hour."
Uucp: {seismo,decvax,...}!ucbvax!oster%dewey.soe.berkeley.edu