|
Retro Rocket Kernel
BASIC-Powered Operating System
|
BASIC program context. Every instance of a BASIC program has one of these,* also certain structures such as functions will clone the context and run on the clone until the function completes. Cloned contexts share variables and you should never call basic_destroy() on them! More...
#include <basic.h>
Collaboration diagram for basic_ctx:Data Fields | |
| char const * | ptr |
| Pointer to the start of the next token Always between program_ptr and program_ptr + strlen(program_ptr) More... | |
| char const * | nextptr |
| Pointer to the character after the next token. Always between program_ptr and program_ptr + strlen(program_ptr) More... | |
| int | current_token |
| Numeric form of the token between ptr and nextptr. Should always be a value within the enum token_t. More... | |
| int64_t | current_linenum |
| Current line number. More... | |
| bool | errored |
| True if the program has thrown an error and should end. This may not actually cause termination of the program if we are inside an EVAL at the time. More... | |
| bool | ended |
| True if the program has ended, e.g. it reached an explicit END statement, or fell off the end of the program to the terminating null char. More... | |
| char * | program_ptr |
| The whole program text, untokenized. May have been "cleaned" by an initial preprocessing phase which removes unneccesary spacing etc. More... | |
| char | string [1024] |
| A context-local string buffer used for parsing function/procedure parameter lists. More... | |
| struct ub_var_int * | local_int_variables [255] |
| Local integer variable stack for variables declared within a function or procedure scope. More... | |
| struct ub_var_string * | local_string_variables [255] |
| Local string variable stack for variables declared within a function or procedure scope. More... | |
| struct ub_var_double * | local_double_variables [255] |
| Local real (double) variable stack for variables declared within a function or procedure scope. More... | |
| uint64_t | call_stack [255] |
| Call stack, holds the return line numbers for each level of calls to a procedure, function or GOSUB. More... | |
| uint64_t | call_stack_ptr |
| How far up the call stack we are. The call stack pointer starts at 0, and can go as high as MAX_CALL_STACK_DEPTH - 1. More... | |
| uint64_t | repeat_stack [255] |
| Repeat stack, holds the return line numbers for each level of REPEAT...UNTIL loop. More... | |
| uint64_t | repeat_stack_ptr |
| How far up the REPEAT...UNTIL stack we are. The repeat stack pointer starts at 0, and can go as high as MAX_LOOP_STACK_DEPTH - 1. More... | |
| size_t | oldlen |
| Previous program length, before an EVAL statement. An EVAL statement appends additional lines to the program beyond its original end, storing the previous size in this value. If this value is non-zero an EVAL is in progress, otherwise no EVAL is executing. More... | |
| int64_t | eval_linenum |
| The return line number for an EVAL statement. More... | |
| struct for_state | for_stack [255] |
| FOR stack, holds the return line numbers for each level of FOR...NEXT loop. More... | |
| uint64_t | for_stack_ptr |
| How far up the FOR...NEXT stack we are. The FOR stack pointer starts at 0, and can go as high as MAX_LOOP_STACK_DEPTH - 1. More... | |
| struct ub_proc_fn_def * | defs |
| Definitions for procedures and functions in the program. More... | |
| struct ub_var_int * | int_variables |
| Global integer variable list. More... | |
| struct ub_var_string * | str_variables |
| Global string variable list. More... | |
| struct ub_var_double * | double_variables |
| Global double variable list. More... | |
| struct ub_var_int_array * | int_array_variables |
| Global integer array variable list. More... | |
| struct ub_var_string_array * | string_array_variables |
| Global string array variable list. More... | |
| struct ub_var_double_array * | double_array_variables |
| Global double array variable list. More... | |
| struct console * | cons |
| I/O Console. More... | |
| ub_return_type | fn_type |
| Function return type expected. This is only relavent when executing a function atomically. More... | |
| void * | fn_return |
| Function return value pointer. This is only relavent when executing a function atomically. More... | |
| int | bracket_depth |
| Bracket depth when parsing function or procedure parameter lists. More... | |
| char const * | item_begin |
| Item start pointer when parsing function or procedure parameter lists. More... | |
| struct ub_param * | param |
| Linked list of function parameters when parsing function or procedure parameter lists. More... | |
| int32_t | graphics_colour |
| Current graphics colour (GCOL) for graphics drawing commands. More... | |
| cpuid_result_t | last_cpuid_result |
| struct hashmap * | lines |
| Hashmap of lines for O(1) lookup of line numbers. More... | |
| uint64_t | if_nest_level |
| Block IF...THEN...ELSE depth. More... | |
| int64_t | highest_line |
| highest line number in program More... | |
BASIC program context. Every instance of a BASIC program has one of these,* also certain structures such as functions will clone the context and run on the clone until the function completes. Cloned contexts share variables and you should never call basic_destroy() on them!
| int basic_ctx::bracket_depth |
Bracket depth when parsing function or procedure parameter lists.
| uint64_t basic_ctx::call_stack[255] |
Call stack, holds the return line numbers for each level of calls to a procedure, function or GOSUB.
| uint64_t basic_ctx::call_stack_ptr |
How far up the call stack we are. The call stack pointer starts at 0, and can go as high as MAX_CALL_STACK_DEPTH - 1.
| struct console* basic_ctx::cons |
I/O Console.
| int64_t basic_ctx::current_linenum |
Current line number.
| int basic_ctx::current_token |
Numeric form of the token between ptr and nextptr. Should always be a value within the enum token_t.
| struct ub_proc_fn_def* basic_ctx::defs |
Definitions for procedures and functions in the program.
| struct ub_var_double_array* basic_ctx::double_array_variables |
Global double array variable list.
| struct ub_var_double* basic_ctx::double_variables |
Global double variable list.
| bool basic_ctx::ended |
True if the program has ended, e.g. it reached an explicit END statement, or fell off the end of the program to the terminating null char.
| bool basic_ctx::errored |
True if the program has thrown an error and should end. This may not actually cause termination of the program if we are inside an EVAL at the time.
| int64_t basic_ctx::eval_linenum |
The return line number for an EVAL statement.
| void* basic_ctx::fn_return |
Function return value pointer. This is only relavent when executing a function atomically.
| ub_return_type basic_ctx::fn_type |
Function return type expected. This is only relavent when executing a function atomically.
| struct for_state basic_ctx::for_stack[255] |
FOR stack, holds the return line numbers for each level of FOR...NEXT loop.
| uint64_t basic_ctx::for_stack_ptr |
How far up the FOR...NEXT stack we are. The FOR stack pointer starts at 0, and can go as high as MAX_LOOP_STACK_DEPTH - 1.
| int32_t basic_ctx::graphics_colour |
Current graphics colour (GCOL) for graphics drawing commands.
| int64_t basic_ctx::highest_line |
highest line number in program
| uint64_t basic_ctx::if_nest_level |
Block IF...THEN...ELSE depth.
| struct ub_var_int_array* basic_ctx::int_array_variables |
Global integer array variable list.
| struct ub_var_int* basic_ctx::int_variables |
Global integer variable list.
| char const* basic_ctx::item_begin |
Item start pointer when parsing function or procedure parameter lists.
| cpuid_result_t basic_ctx::last_cpuid_result |
| struct hashmap* basic_ctx::lines |
Hashmap of lines for O(1) lookup of line numbers.
| struct ub_var_double* basic_ctx::local_double_variables[255] |
Local real (double) variable stack for variables declared within a function or procedure scope.
| struct ub_var_int* basic_ctx::local_int_variables[255] |
Local integer variable stack for variables declared within a function or procedure scope.
| struct ub_var_string* basic_ctx::local_string_variables[255] |
Local string variable stack for variables declared within a function or procedure scope.
| char const* basic_ctx::nextptr |
Pointer to the character after the next token. Always between program_ptr and program_ptr + strlen(program_ptr)
| size_t basic_ctx::oldlen |
Previous program length, before an EVAL statement. An EVAL statement appends additional lines to the program beyond its original end, storing the previous size in this value. If this value is non-zero an EVAL is in progress, otherwise no EVAL is executing.
| struct ub_param* basic_ctx::param |
Linked list of function parameters when parsing function or procedure parameter lists.
| char* basic_ctx::program_ptr |
The whole program text, untokenized. May have been "cleaned" by an initial preprocessing phase which removes unneccesary spacing etc.
| char const* basic_ctx::ptr |
Pointer to the start of the next token Always between program_ptr and program_ptr + strlen(program_ptr)
| uint64_t basic_ctx::repeat_stack[255] |
Repeat stack, holds the return line numbers for each level of REPEAT...UNTIL loop.
| uint64_t basic_ctx::repeat_stack_ptr |
How far up the REPEAT...UNTIL stack we are. The repeat stack pointer starts at 0, and can go as high as MAX_LOOP_STACK_DEPTH - 1.
| struct ub_var_string* basic_ctx::str_variables |
Global string variable list.
| char basic_ctx::string[1024] |
A context-local string buffer used for parsing function/procedure parameter lists.
| struct ub_var_string_array* basic_ctx::string_array_variables |
Global string array variable list.