In Forth every task has essentially the same task-local data, called
“user” area (early Forth systems were multi-user systems and there
often was one user per task). The task result of,
e.g. newtask
is the start address of its user area. Each task
gets the user data defined by the system (e.g., base
). You can
define additional user data with:
User
( "name" – ) gforth-0.2 “User”
Name is a user variable (1 cell).
Name execution: ( – addr )
Addr is the address of the user variable in the current task.
AUser
( "name" – ) gforth-0.2 “AUser”
Name is a user variable containing an address (this only makes a difference in the cross-compiler).
uallot
( n1 – n2 ) gforth-0.3 “uallot”
Reserve n1 bytes of user data. n2 is the offset of the start of the reserved area within the user area.
UValue
( "name" – ) gforth-1.0 “UValue”
Name is a user value.
Name execution: ( – x )
UDefer
( "name" – ) gforth-1.0 “UDefer”
Name is a task-local deferred word.
Name execution: ( ... – ... )
There are also the following words for dealing with user data.
up@
( – a-addr ) new “up-fetch”
Addr is the start of the user area of the current task (addr also serves as the task identifier of the current task).
user'
( "name" – u ) gforth-experimental “user”’
U is the offset of the user variable name in the user area of each task.
's
( addr1 task – addr2 ) gforth-experimental “’s”
With addr1 being an address in the user data of the current task, addr2 is the corresponding address in task’s user data.