#define DEF_SIZE 5000
#define STACK 50
-int internal_wanted;
-int internal_mode;
-
-int warning;
-
/* Here is a string type ... */
typedef struct buffer
unsigned long size;
} string_type;
+typedef void (*stinst_type)();
+
+typedef struct dict_struct
+{
+ char *word;
+ struct dict_struct *next;
+ stinst_type *code;
+ int code_length;
+ int code_end;
+} dict_type;
+
+int internal_wanted;
+int internal_mode;
+
+int warning;
+
+string_type stack[STACK];
+string_type *tos;
+
+unsigned int idx = 0; /* Pos in input buffer */
+string_type *ptr; /* and the buffer */
+
+long istack[STACK];
+long *isp = &istack[0];
+
+dict_type *root;
+
+stinst_type *pc;
+
#ifdef __STDC__
static void init_string_with_size (string_type *, unsigned int);
static void init_string (string_type *);
static void die (char *);
#endif
+static void
+die (msg)
+ char *msg;
+{
+ fprintf (stderr, "%s\n", msg);
+ exit (1);
+}
+
static void
init_string_with_size (buffer, size)
string_type *buffer;
return idx;
}
-/***********************************************************************/
-
-string_type stack[STACK];
-string_type *tos;
-
-unsigned int idx = 0; /* Pos in input buffer */
-string_type *ptr; /* and the buffer */
-typedef void (*stinst_type)();
-stinst_type *pc;
-stinst_type sstack[STACK];
-stinst_type *ssp = &sstack[0];
-long istack[STACK];
-long *isp = &istack[0];
-
-typedef int *word_type;
-
-struct dict_struct
-{
- char *word;
- struct dict_struct *next;
- stinst_type *code;
- int code_length;
- int code_end;
- int var;
-};
-
-typedef struct dict_struct dict_type;
-
-static void
-die (msg)
- char *msg;
-{
- fprintf (stderr, "%s\n", msg);
- exit (1);
-}
-
static void
check_range ()
{
dict_type *newentry (char *);
unsigned int add_to_definition (dict_type *, stinst_type);
void add_intrinsic (char *, void (*)());
-void add_var (char *);
void compile (char *);
static void bang (void);
static void atsign (void);
return NULL;
}
-dict_type *root;
-
dict_type *
lookup_word (word)
char *word;
add_to_definition (new_d, 0);
}
-void
-add_var (name)
- char *name;
-{
- dict_type *new_d = newentry (name);
- add_to_definition (new_d, push_number);
- add_to_definition (new_d, (stinst_type) (&(new_d->var)));
- add_to_definition (new_d, 0);
-}
-
void
compile (string)
char *string;
string = nextword (string, &word);
while (string && *string && word[0])
{
- if (strcmp (word, "var") == 0)
- {
- free (word);
- string = nextword (string, &word);
- if (!string)
- continue;
- add_var (word);
- string = nextword (string, &word);
- }
- else if (word[0] == ':')
+ if (word[0] == ':')
{
dict_type *ptr;