string_type stack[STACK];
string_type *tos;
-unsigned int idx = 0; /* Pos in input buffer */
-string_type *ptr; /* and the buffer */
+unsigned int pos_idx = 0; /* Pos in input buffer */
+string_type *buf_ptr; /* and the buffer */
intptr_t istack[STACK];
intptr_t *isp = &istack[0];
exit (1);
}
-void *
+static void *
xmalloc (size_t size)
{
void *newmem;
return newmem;
}
-void *
+static void *
xrealloc (void *oldmem, size_t size)
{
void *newmem;
return newmem;
}
-char *
+static char *
xstrdup (const char *s)
{
size_t len = strlen (s) + 1;
tos++;
check_range ();
init_string (tos);
- idx = copy_past_newline (ptr, idx, tos);
+ pos_idx = copy_past_newline (buf_ptr, pos_idx, tos);
pc++;
}
check_range ();
init_string (tos);
- while (at (ptr, idx))
+ while (at (buf_ptr, pos_idx))
{
- if (iscommand (ptr, idx))
+ if (iscommand (buf_ptr, pos_idx))
break;
- idx = copy_past_newline (ptr, idx, tos);
+ pos_idx = copy_past_newline (buf_ptr, pos_idx, tos);
}
pc++;
}
static void
skip_past_newline (void)
{
- idx = skip_past_newline_1 (ptr, idx);
+ pos_idx = skip_past_newline_1 (buf_ptr, pos_idx);
pc++;
}
pc++;
}
-char *
+static char *
nextword (char *string, char **word)
{
char *word_start;
return NULL;
}
-dict_type *
+static dict_type *
lookup_word (char *word)
{
dict_type *ptr = root;
{
tos = stack;
- while (at (ptr, idx))
+ while (at (buf_ptr, pos_idx))
{
/* It's worth looking through the command list. */
- if (iscommand (ptr, idx))
+ if (iscommand (buf_ptr, pos_idx))
{
char *next;
dict_type *word;
- (void) nextword (addr (ptr, idx), &next);
+ (void) nextword (addr (buf_ptr, pos_idx), &next);
word = lookup_word (next);
{
if (warning)
fprintf (stderr, "warning, %s is not recognised\n", next);
- idx = skip_past_newline_1 (ptr, idx);
+ pos_idx = skip_past_newline_1 (buf_ptr, pos_idx);
}
free (next);
}
else
- idx = skip_past_newline_1 (ptr, idx);
+ pos_idx = skip_past_newline_1 (buf_ptr, pos_idx);
}
}
-dict_type *
+static dict_type *
newentry (char *word)
{
dict_type *new_d = xmalloc (sizeof (*new_d));
return new_d;
}
-unsigned int
+static unsigned int
add_to_definition (dict_type *entry, pcu word)
{
if (entry->code_end == entry->code_length)
return entry->code_end++;
}
-void
+static void
add_intrinsic (char *name, void (*func) (void))
{
dict_type *new_d = newentry (xstrdup (name));
add_variable (xstrdup (name), loc);
}
-void
+static void
compile (char *string)
{
/* Add words to the dictionary. */
init_string (&pptr);
init_string (stack + 0);
tos = stack + 1;
- ptr = &pptr;
+ buf_ptr = &pptr;
add_intrinsic ("push_text", push_text);
add_intrinsic ("!", bang);
catchar (&buffer, '\n');
read_in (&buffer, stdin);
- remove_noncomments (&buffer, ptr);
+ remove_noncomments (&buffer, buf_ptr);
for (i = 1; i < (unsigned int) ac; i++)
{
if (av[i][0] == '-')