Global variables have a name, and a value. The name is the name of the variable itself, just like an SBasic variable, and the value is the content of this. For example, the global variable PWSDIR contains the name of the directory from which you booted ProWesS, e.g. flp1_, or win1_pw_, or whatever.
GSET name$,value$ GDEL name$
where name$ is the name of the global variable, such as PWSDIR, and value$ is the value of this variable. Please note that both parameters are strings. GDEL deletes the variable - it no longer exists after this. GSET sets the global variable whose name is name$, to the value$ indicated.
result$ = GGET (name$)
where name$ is the name of the variable the content of which is then returned in result$. If this variable does not exist, the function returns "--" (two minus signs).
GFRST name$,value$ GNEXT name$,value$
where, again, name$ is the name of the global variable, such as PWSDIR, and value$ is the value of this variable.
For GFRST, these two variable are filled in on return from the keyword, it doesn't matter at all what they contain at first.
For GNEXT, the name$ parameter must contain, on entry, the name of the last global variable (after which you want to find the next one) (e.g. as obtained with GFRST), and will contain, after the call to GNEXT, the name of the next one, and so on.
Please note that both parameters are strings and are filled in on return from the keywords. GFRST gets the name and value of the first global variable, GNEXT that of the next one (and the next one, and the next one etc...). This way you can find out all of the global variables in you system, and the value of them (see the examples). If there are no more global variables (for GNEXT) or none at all (for GFRST), the name$ and value$ are both set to '-- '(i.e. two minus signs).
GSET "A NEW VARIABLE","This is my value"this sets the new variable.
PRINT GGET ("A NEW VARIABLE")will print 'This is my value'. But:
PRINT GGET ("a new variable")will print -- since this variable was not found.
The following small program prints all of the global variables in your system.
gname$="" gvalue$="" GFRST gname$,gvalue$ IF gname$='--' PRINT 'There is NO global variable!' STOP ENDIF PRINT gname$; " = ";gvalue$ REPeat loop GNEXT gname$,gvalue$ IF gname$='--':EXIT loop PRINT gname$;" = ";gvalue$ END REP loopYou can see how we leave gname$ alone, so that, on each call to GNEXT, it still contains the name of the last variable, enabling us to get the one after that, i.e. the next one.