Lhogho
0.0.028
|
Go to the source code of this file.
Data Structures | |
struct | prim_t |
description of a primitive More... | |
Macros | |
#define | FLAG_EX_PRINTDEPTHLIMIT 0x00010000 |
extended flag for PRINTDEPTHLIMIT More... | |
#define | FLAG_EX_PRINTWIDTHLIMIT 0x00020000 |
extended flag for PRINTWIDTHLIMIT More... | |
#define | FLAG_EX_FULLPRINTP 0x00040000 |
extended flag for FULLPRINTP More... | |
#define | FLAG_EX_CASEIGNOREDP 0x00080000 |
extended flag for CASEIGNOREDP More... | |
#define | FLAG_EX_LOGOPLATFORM 0x00100000 |
extended flag for LOGOPLATFORM More... | |
#define | FLAG_EX_LOGOVERSION 0x00200000 |
extended flag for LOGOVERSION More... | |
#define | FLAG_EX_LOGODIALECT 0x00400000 |
extended flag for LOGODIALECT More... | |
#define | DUMP_BUF_SIZE 128 |
Typedefs | |
typedef struct prim_t | primitive_t |
description structure of a primitive More... | |
Functions | |
void | init_vars () |
initializes variables More... | |
void | finit_vars () |
finalizes the Varss module More... | |
atom_t | new_var (atom_t name, atom_t parent, int attach) |
creates a new var atom More... | |
int | need_descr2 (atom_t var) |
creates var descriptor if needed More... | |
void | delete_var (atom_t a) |
deletes var atom More... | |
void | dump_var (atom_t a, int level) |
dumps error atom More... | |
atom_t | find_var (atom_t name, atom_t parent) |
searches a variable More... | |
atom_t | find_local_runtime_var (atom_t name, int frame) |
searches a variable at runtime More... | |
atom_t | find_runtime_var (atom_t name, int frame) |
searches a variable at runtime More... | |
atom_t | find_local_var (atom_t name, atom_t parent) |
searches a local variable More... | |
atom_t | new_local_var (atom_t name, atom_t function, int quoted) |
creates a new local var More... | |
void | copy_local_vars (int frame) |
copy local vars to parent More... | |
Variables | |
atom_t | root |
parent of all variables More... | |
atom_t | word_to |
word containing "TO" token More... | |
atom_t | word_to_syn |
word containing a synonym of "TO" token More... | |
atom_t | word_end |
word containing "END" token More... | |
atom_t | word_run |
word containing "RUN" token More... | |
atom_t | word_make |
word containing "MAKE" token More... | |
atom_t | word_plus |
word containing "+" token More... | |
atom_t | word_toplevel |
word containing "TOPLEVEL" token More... | |
atom_t | word_system |
word containing "SYSTEM" token More... | |
atom_t | word_error |
word containing "ERROR" token More... | |
atom_t | unbound |
atom representing unbound values More... | |
atom_t | stopped |
atom representing stop values More... | |
atom_t | repeat_chain |
atom for the topmost repeat chain More... | |
atom_t | globals |
collection of global system-wide persistent variables More... | |
atom_t | printdepthlimit |
variable PRINTDEPTHLIMIT More... | |
atom_t | printwidthlimit |
variable PRINTWIDTHLIMIT More... | |
atom_t | fullprintp |
variable FULLPRINTP More... | |
atom_t | caseignoredp |
variable CASEIGNOREDP More... | |
atom_t | last_error |
last caught error (used by ERROR primitive) More... | |
atom_t | delayed_free |
atoms sheduled for delayed free More... | |
int | root_frame |
frame of root More... | |
int | backup_frame |
run-time backup of frame More... | |
atom_t | error_flag |
error flag (used by internal/external functions) More... | |
int | catch_output_flag |
1 = there was output/stop in catch More... | |
primitive_t | vars [] |
array with actual properties of primitives More... | |
#define DUMP_BUF_SIZE 128 |
typedef struct prim_t primitive_t |
void init_vars | ( | ) |
as local variables to the root variable. The names of primitives are taken from TR_PRIMITIVES, the properties are taken from vars[]. Two words :to and :end are created.
Initializes the variables module by creating the system root variable which is named as defined by ROOT_VAR_NAME, and globals variable defined by
Definition at line 525 of file vars.c.
void finit_vars | ( | ) |
Finilizes the Vars module by freeing :to, :end and :root atoms. Deleting :root will recursively delete all other variables including the primitives.
Some system primitive variables like fullprintp, printwidthlimit, and printdepthlimit does not need individual finalization, because they are included in globals and finalized when globals is finalized.
Definition at line 661 of file vars.c.
name | word atom for the name of the variable |
parent | var atom for the parent of the variable |
attach | 1=attach to parent, 0=do not attach |
Creates a var atom describing a variable with given name and parent. The reference count of the var is set to 1, the reference count of name
is increased, the reference count of parent
is not changed. The function automatically creates the first descriptor of the var atom. The second descriptor is left uninitialized - it could be later created by need_descr2()
if needed.
The newly created var atom is included in the list of local variables of the parent only if attach
!= 0. Otherwise var has a parent, but the parent does not know about the child var.
Definition at line 750 of file vars.c.
int need_descr2 | ( | atom_t | var) |
name | word atom containing the searched name |
parent | var atom where to start the search |
NULL
if not found Searches a variable named name
starting from variable parent
. If not found found the search continues with the parent of parent
, then with its grandparent, and so on untill the root is reached. If still not found search continues within the globals variable.
This search schema can find only variables known at the time of compilation. Also, the search is strictly syntax-scope based.
Definition at line 1015 of file vars.c.
name | word atom containing the searched name |
frame | starting frame for the search |
NULL
if not foundSearches a variable named name
in the the given stack frame. Search is done in the list of variables created at run-time.
If the variable is not found in the runtimers, then search continues with compile-time vars.
Definition at line 1074 of file vars.c.
name | word atom containing the searched name |
frame | starting frame for the search |
NULL
if not found Searches a variable named name
starting from the given stack frame. Search is done in the list of variables created at run-time.
If the variable is not found in the runtimers, then search continues with compile-time vars.
If still not found, the search moves to the parent frame.
If not found in all frames up to the root, then scan the globals var.
Definition at line 1133 of file vars.c.
name | word atom containing the searched name |
parent | var atom where to start the search |
NULL
if not found Searches a variable named name
starting from variable parent
. If found returns the var atom, otherwise returns NULL
. The search scans only the variables parent
. It does not scan its parents.
This search schema can find only variables known at the time of compilation. Also, the search is strictly syntax-scope based.
If the parent is a list atom, then just scan its elements (as if this is the LOCALS field of a var)
Definition at line 1210 of file vars.c.
name | word atom for the name of the variable |
function | var atom for the parent of the variable |
quoted | shows whether the name is quoted |
Creates a local variable in a function. The input name
contains the name of the local variable together with the : or " character (if quoted!=0). If such local variable does not exist in the function, then it is created and returned to the caller. Otherwise an error atom of ERROR_DUPLICATE_INPUT error is returned.
Definition at line 1258 of file vars.c.
atom_t copy_local_vars | ( | int | frame) |
frame | current frame pointer |
This function is called from the generated code. It copies all local variables of the current frame into the dynamic parent (i.e. caller).
Copying variables consideres these cases:
No Flag Type Action
Definition at line 1315 of file vars.c.
primitive_t vars[] |