pforth  0943e5e71114f286dbb2474d55aabf91df02d104
interp.c File Reference
#include "pforth.h"
#include "token.h"

Data Structures

struct  _loop_struct
 

Functions

char * strndup (const char *src, size_t len)
 
char upcase (char c)
 
int preprocess (char *line)
 
void eval (dict_t *dict, const char *line, const char *line_end)
 

Variables

static struct _loop_struct loops [MAX_DO_LOOP_DEPTH]
 
const char * begin_loops [MAX_BEGIN_LOOP_DEPTH]
 
static FORTH_TYPE if_depth
 
static FORTH_TYPE do_loop_depth
 
static FORTH_TYPE begin_loop_depth
 

Function Documentation

void eval ( dict_t dict,
const char *  line,
const char *  line_end 
)

Evaluate the FORTH line

Parameters
dictthe dictionary to use
linethe FORTH line
line_endthe last byte to interpret, if NULL then function evaluates ASCIIZ line
int preprocess ( char *  line)

Preprocess the FORTH line.

The preprocessing is done in-place, comments and newlines are removed by replacing with space characters. There's no space compression pass - it's easier to do that right in eval().

Parameters
linethe line to be preprocessed.
char* strndup ( const char *  src,
size_t  len 
)
char upcase ( char  c)

Variable Documentation

FORTH_TYPE begin_loop_depth
static
const char* begin_loops[MAX_BEGIN_LOOP_DEPTH]
FORTH_TYPE do_loop_depth
static
FORTH_TYPE if_depth
static
struct _loop_struct loops[MAX_DO_LOOP_DEPTH]
static