install.doc

Sapphire/doc/em/install.doc · 2.2 KB

From the archive sapphire_0.3.zip

Download the archive   « Back to the archive contents

	This document describes all the functions and global variables you
will need to use to install my stack-based Emerald Interpreter.

--


int iEmError;

	Used mostly to signal an error by functions that do not return an
integer.  If iEmError is set to anything other then 0 an error has taken
place.


char cErrorBuf[];

	If an error has taken place this array will always contain a string
describing it.


void print_error( void );

	Prints out the string in cErrorBuf.


int iEmInterpStackSize;

	Maximum number of values the interpreter (run) stack can hold at one
time.


int iEmVarStackSize;

	Maximum number of variables that can exist at one time.


bool bEmFuncUsage;
char *pEmUsageFilename;

	If bEmFuncUsage is TRUE a list of function calls for each user
function will be written to pEmUsageFilename.


int em_load_obj_file( char *filename );

	Attemps to load the Emerald object referenced by filename into a
running system.  Returns 0 on success, upon failure returns less then 0
and sets cErrorBuf[] to a string describing the error and iEmError to an
error code.


void em_translate( void );

	When called, examines all byte codes and translates all TRANS_* byte
codes into actaul instructions.  If an error takes place in em_translate()
it will print the error and then exit(1).  You normally only want to call
this function after you are finished loading all the Emerald object files.


byte *bct( byte *instr );

	Low level function for translating byte codes.  Translates one byte
code and returns the next byte code in the instruction stream.  This
function is called recursively by em_translate().  If an error happens
while translating *instr iEmError will be set to indicate the error and
cErrorBuf[] will be set to a string describing the error.


int em_find_func( char *func );

	Finds the function with the name func and returns it's index in the
function table.  Returns -1 if no such function exists.


int em_call_func( int func );

	Calls the function referenced by func.  The arguments must already
be on the interpreter stack.  Returns 0 if successful, less then 0 if the
call failed.


<This document is incomplete>

--

Site Stats

Snippets: 1791
Codebases: 571