mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 07:08:01 +08:00
Update K&R functions in bfd/doc/chew.c
* doc/chew.c: Update function definitions to ISO C, remove now unnecessary prototypes.
This commit is contained in:
224
bfd/doc/chew.c
224
bfd/doc/chew.c
@ -100,7 +100,7 @@ typedef struct buffer
|
|||||||
unsigned long size;
|
unsigned long size;
|
||||||
} string_type;
|
} string_type;
|
||||||
|
|
||||||
typedef void (*stinst_type)();
|
typedef void (*stinst_type) (void);
|
||||||
|
|
||||||
typedef struct dict_struct
|
typedef struct dict_struct
|
||||||
{
|
{
|
||||||
@ -129,34 +129,15 @@ dict_type *root;
|
|||||||
|
|
||||||
stinst_type *pc;
|
stinst_type *pc;
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
static void init_string_with_size (string_type *, unsigned int);
|
|
||||||
static void init_string (string_type *);
|
|
||||||
static int find (string_type *, char *);
|
|
||||||
static void write_buffer (string_type *, FILE *);
|
|
||||||
static void delete_string (string_type *);
|
|
||||||
static char *addr (string_type *, unsigned int);
|
|
||||||
static char at (string_type *, unsigned int);
|
|
||||||
static void catchar (string_type *, int);
|
|
||||||
static void overwrite_string (string_type *, string_type *);
|
|
||||||
static void catbuf (string_type *, char *, unsigned int);
|
|
||||||
static void cattext (string_type *, char *);
|
|
||||||
static void catstr (string_type *, string_type *);
|
|
||||||
static void die (char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
die (msg)
|
die (char *msg)
|
||||||
char *msg;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s\n", msg);
|
fprintf (stderr, "%s\n", msg);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_string_with_size (buffer, size)
|
init_string_with_size (string_type *buffer, unsigned int size)
|
||||||
string_type *buffer;
|
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
buffer->write_idx = 0;
|
buffer->write_idx = 0;
|
||||||
buffer->size = size;
|
buffer->size = size;
|
||||||
@ -164,16 +145,13 @@ init_string_with_size (buffer, size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_string (buffer)
|
init_string (string_type *buffer)
|
||||||
string_type *buffer;
|
|
||||||
{
|
{
|
||||||
init_string_with_size (buffer, DEF_SIZE);
|
init_string_with_size (buffer, DEF_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find (str, what)
|
find (string_type *str, char *what)
|
||||||
string_type *str;
|
|
||||||
char *what;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *p;
|
char *p;
|
||||||
@ -189,9 +167,7 @@ find (str, what)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_buffer (buffer, f)
|
write_buffer (string_type *buffer, FILE *f)
|
||||||
string_type *buffer;
|
|
||||||
FILE *f;
|
|
||||||
{
|
{
|
||||||
if (buffer->write_idx != 0
|
if (buffer->write_idx != 0
|
||||||
&& fwrite (buffer->ptr, buffer->write_idx, 1, f) != 1)
|
&& fwrite (buffer->ptr, buffer->write_idx, 1, f) != 1)
|
||||||
@ -199,25 +175,20 @@ write_buffer (buffer, f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delete_string (buffer)
|
delete_string (string_type *buffer)
|
||||||
string_type *buffer;
|
|
||||||
{
|
{
|
||||||
free (buffer->ptr);
|
free (buffer->ptr);
|
||||||
buffer->ptr = NULL;
|
buffer->ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
addr (buffer, idx)
|
addr (string_type *buffer, unsigned int idx)
|
||||||
string_type *buffer;
|
|
||||||
unsigned int idx;
|
|
||||||
{
|
{
|
||||||
return buffer->ptr + idx;
|
return buffer->ptr + idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char
|
static char
|
||||||
at (buffer, pos)
|
at (string_type *buffer, unsigned int pos)
|
||||||
string_type *buffer;
|
|
||||||
unsigned int pos;
|
|
||||||
{
|
{
|
||||||
if (pos >= buffer->write_idx)
|
if (pos >= buffer->write_idx)
|
||||||
return 0;
|
return 0;
|
||||||
@ -225,9 +196,7 @@ at (buffer, pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
catchar (buffer, ch)
|
catchar (string_type *buffer, int ch)
|
||||||
string_type *buffer;
|
|
||||||
int ch;
|
|
||||||
{
|
{
|
||||||
if (buffer->write_idx == buffer->size)
|
if (buffer->write_idx == buffer->size)
|
||||||
{
|
{
|
||||||
@ -239,9 +208,7 @@ catchar (buffer, ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
overwrite_string (dst, src)
|
overwrite_string (string_type *dst, string_type *src)
|
||||||
string_type *dst;
|
|
||||||
string_type *src;
|
|
||||||
{
|
{
|
||||||
free (dst->ptr);
|
free (dst->ptr);
|
||||||
dst->size = src->size;
|
dst->size = src->size;
|
||||||
@ -250,10 +217,7 @@ overwrite_string (dst, src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
catbuf (buffer, buf, len)
|
catbuf (string_type *buffer, char *buf, unsigned int len)
|
||||||
string_type *buffer;
|
|
||||||
char *buf;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
{
|
||||||
if (buffer->write_idx + len >= buffer->size)
|
if (buffer->write_idx + len >= buffer->size)
|
||||||
{
|
{
|
||||||
@ -266,25 +230,19 @@ catbuf (buffer, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cattext (buffer, string)
|
cattext (string_type *buffer, char *string)
|
||||||
string_type *buffer;
|
|
||||||
char *string;
|
|
||||||
{
|
{
|
||||||
catbuf (buffer, string, (unsigned int) strlen (string));
|
catbuf (buffer, string, (unsigned int) strlen (string));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
catstr (dst, src)
|
catstr (string_type *dst, string_type *src)
|
||||||
string_type *dst;
|
|
||||||
string_type *src;
|
|
||||||
{
|
{
|
||||||
catbuf (dst, src->ptr, src->write_idx);
|
catbuf (dst, src->ptr, src->write_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
skip_white_and_stars (src, idx)
|
skip_white_and_stars (string_type *src, unsigned int idx)
|
||||||
string_type *src;
|
|
||||||
unsigned int idx;
|
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
while ((c = at (src, idx)),
|
while ((c = at (src, idx)),
|
||||||
@ -299,9 +257,7 @@ skip_white_and_stars (src, idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
skip_past_newline_1 (ptr, idx)
|
skip_past_newline_1 (string_type *ptr, unsigned int idx)
|
||||||
string_type *ptr;
|
|
||||||
unsigned int idx;
|
|
||||||
{
|
{
|
||||||
while (at (ptr, idx)
|
while (at (ptr, idx)
|
||||||
&& at (ptr, idx) != '\n')
|
&& at (ptr, idx) != '\n')
|
||||||
@ -312,7 +268,7 @@ skip_past_newline_1 (ptr, idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_range ()
|
check_range (void)
|
||||||
{
|
{
|
||||||
if (tos < stack)
|
if (tos < stack)
|
||||||
die ("underflow in string stack");
|
die ("underflow in string stack");
|
||||||
@ -321,7 +277,7 @@ check_range ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
icheck_range ()
|
icheck_range (void)
|
||||||
{
|
{
|
||||||
if (isp < istack)
|
if (isp < istack)
|
||||||
die ("underflow in integer stack");
|
die ("underflow in integer stack");
|
||||||
@ -329,44 +285,8 @@ icheck_range ()
|
|||||||
die ("overflow in integer stack");
|
die ("overflow in integer stack");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
static void exec (dict_type *);
|
|
||||||
static void call (void);
|
|
||||||
static void remchar (void), strip_trailing_newlines (void), push_number (void);
|
|
||||||
static void push_text (void);
|
|
||||||
static void remove_noncomments (string_type *, string_type *);
|
|
||||||
static void print_stack_level (void);
|
|
||||||
static void paramstuff (void), translatecomments (void);
|
|
||||||
static void outputdots (void), courierize (void), bulletize (void);
|
|
||||||
static void do_fancy_stuff (void);
|
|
||||||
static int iscommand (string_type *, unsigned int);
|
|
||||||
static int copy_past_newline (string_type *, unsigned int, string_type *);
|
|
||||||
static void icopy_past_newline (void), kill_bogus_lines (void), indent (void);
|
|
||||||
static void get_stuff_in_command (void), swap (void), other_dup (void);
|
|
||||||
static void drop (void), idrop (void);
|
|
||||||
static void icatstr (void), skip_past_newline (void), internalmode (void);
|
|
||||||
static void maybecatstr (void);
|
|
||||||
static char *nextword (char *, char **);
|
|
||||||
dict_type *lookup_word (char *);
|
|
||||||
static void perform (void);
|
|
||||||
dict_type *newentry (char *);
|
|
||||||
unsigned int add_to_definition (dict_type *, stinst_type);
|
|
||||||
void add_intrinsic (char *, void (*)());
|
|
||||||
void compile (char *);
|
|
||||||
static void bang (void);
|
|
||||||
static void atsign (void);
|
|
||||||
static void hello (void);
|
|
||||||
static void stdout_ (void);
|
|
||||||
static void stderr_ (void);
|
|
||||||
static void print (void);
|
|
||||||
static void read_in (string_type *, FILE *);
|
|
||||||
static void usage (void);
|
|
||||||
static void chew_exit (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exec (word)
|
exec (dict_type *word)
|
||||||
dict_type *word;
|
|
||||||
{
|
{
|
||||||
pc = word->code;
|
pc = word->code;
|
||||||
while (*pc)
|
while (*pc)
|
||||||
@ -374,7 +294,7 @@ exec (word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call ()
|
call (void)
|
||||||
{
|
{
|
||||||
stinst_type *oldpc = pc;
|
stinst_type *oldpc = pc;
|
||||||
dict_type *e;
|
dict_type *e;
|
||||||
@ -384,7 +304,7 @@ call ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
remchar ()
|
remchar (void)
|
||||||
{
|
{
|
||||||
if (tos->write_idx)
|
if (tos->write_idx)
|
||||||
tos->write_idx--;
|
tos->write_idx--;
|
||||||
@ -392,7 +312,7 @@ remchar ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strip_trailing_newlines ()
|
strip_trailing_newlines (void)
|
||||||
{
|
{
|
||||||
while ((isspace ((unsigned char) at (tos, tos->write_idx - 1))
|
while ((isspace ((unsigned char) at (tos, tos->write_idx - 1))
|
||||||
|| at (tos, tos->write_idx - 1) == '\n')
|
|| at (tos, tos->write_idx - 1) == '\n')
|
||||||
@ -402,7 +322,7 @@ strip_trailing_newlines ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_number ()
|
push_number (void)
|
||||||
{
|
{
|
||||||
isp++;
|
isp++;
|
||||||
icheck_range ();
|
icheck_range ();
|
||||||
@ -412,7 +332,7 @@ push_number ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_text ()
|
push_text (void)
|
||||||
{
|
{
|
||||||
tos++;
|
tos++;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -428,9 +348,7 @@ push_text ()
|
|||||||
Blank lines are turned into one blank line. */
|
Blank lines are turned into one blank line. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
remove_noncomments (src, dst)
|
remove_noncomments (string_type *src, string_type *dst)
|
||||||
string_type *src;
|
|
||||||
string_type *dst;
|
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
|
|
||||||
@ -481,7 +399,7 @@ remove_noncomments (src, dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_stack_level ()
|
print_stack_level (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "current string stack depth = %ld, ",
|
fprintf (stderr, "current string stack depth = %ld, ",
|
||||||
(long) (tos - stack));
|
(long) (tos - stack));
|
||||||
@ -499,7 +417,7 @@ print_stack_level ()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paramstuff ()
|
paramstuff (void)
|
||||||
{
|
{
|
||||||
unsigned int openp;
|
unsigned int openp;
|
||||||
unsigned int fname;
|
unsigned int fname;
|
||||||
@ -572,7 +490,7 @@ paramstuff ()
|
|||||||
and *} into comments */
|
and *} into comments */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
translatecomments ()
|
translatecomments (void)
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
string_type out;
|
string_type out;
|
||||||
@ -604,7 +522,7 @@ translatecomments ()
|
|||||||
|
|
||||||
/* Mod tos so that only lines with leading dots remain */
|
/* Mod tos so that only lines with leading dots remain */
|
||||||
static void
|
static void
|
||||||
outputdots ()
|
outputdots (void)
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
string_type out;
|
string_type out;
|
||||||
@ -653,7 +571,7 @@ outputdots ()
|
|||||||
|
|
||||||
/* Find lines starting with . and | and put example around them on tos */
|
/* Find lines starting with . and | and put example around them on tos */
|
||||||
static void
|
static void
|
||||||
courierize ()
|
courierize (void)
|
||||||
{
|
{
|
||||||
string_type out;
|
string_type out;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
@ -740,7 +658,7 @@ courierize ()
|
|||||||
itemize, inplace at TOS*/
|
itemize, inplace at TOS*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bulletize ()
|
bulletize (void)
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
int on = 0;
|
int on = 0;
|
||||||
@ -795,7 +713,7 @@ bulletize ()
|
|||||||
/* Turn <<foo>> into @code{foo} in place at TOS*/
|
/* Turn <<foo>> into @code{foo} in place at TOS*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_fancy_stuff ()
|
do_fancy_stuff (void)
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
string_type out;
|
string_type out;
|
||||||
@ -834,9 +752,7 @@ do_fancy_stuff ()
|
|||||||
/* A command is all upper case,and alone on a line. */
|
/* A command is all upper case,and alone on a line. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
iscommand (ptr, idx)
|
iscommand (string_type *ptr, unsigned int idx)
|
||||||
string_type *ptr;
|
|
||||||
unsigned int idx;
|
|
||||||
{
|
{
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
while (at (ptr, idx))
|
while (at (ptr, idx))
|
||||||
@ -860,10 +776,7 @@ iscommand (ptr, idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
copy_past_newline (ptr, idx, dst)
|
copy_past_newline (string_type *ptr, unsigned int idx, string_type *dst)
|
||||||
string_type *ptr;
|
|
||||||
unsigned int idx;
|
|
||||||
string_type *dst;
|
|
||||||
{
|
{
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
|
||||||
@ -892,7 +805,7 @@ copy_past_newline (ptr, idx, dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
icopy_past_newline ()
|
icopy_past_newline (void)
|
||||||
{
|
{
|
||||||
tos++;
|
tos++;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -905,7 +818,7 @@ icopy_past_newline ()
|
|||||||
Take the string at the top of the stack, do some prettying. */
|
Take the string at the top of the stack, do some prettying. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
kill_bogus_lines ()
|
kill_bogus_lines (void)
|
||||||
{
|
{
|
||||||
int sl;
|
int sl;
|
||||||
|
|
||||||
@ -992,7 +905,7 @@ kill_bogus_lines ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
indent ()
|
indent (void)
|
||||||
{
|
{
|
||||||
string_type out;
|
string_type out;
|
||||||
int tab = 0;
|
int tab = 0;
|
||||||
@ -1043,7 +956,7 @@ indent ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_stuff_in_command ()
|
get_stuff_in_command (void)
|
||||||
{
|
{
|
||||||
tos++;
|
tos++;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -1059,7 +972,7 @@ get_stuff_in_command ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
swap ()
|
swap (void)
|
||||||
{
|
{
|
||||||
string_type t;
|
string_type t;
|
||||||
|
|
||||||
@ -1070,7 +983,7 @@ swap ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
other_dup ()
|
other_dup (void)
|
||||||
{
|
{
|
||||||
tos++;
|
tos++;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -1080,7 +993,7 @@ other_dup ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drop ()
|
drop (void)
|
||||||
{
|
{
|
||||||
tos--;
|
tos--;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -1089,7 +1002,7 @@ drop ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
idrop ()
|
idrop (void)
|
||||||
{
|
{
|
||||||
isp--;
|
isp--;
|
||||||
icheck_range ();
|
icheck_range ();
|
||||||
@ -1097,7 +1010,7 @@ idrop ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
icatstr ()
|
icatstr (void)
|
||||||
{
|
{
|
||||||
tos--;
|
tos--;
|
||||||
check_range ();
|
check_range ();
|
||||||
@ -1107,14 +1020,14 @@ icatstr ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
skip_past_newline ()
|
skip_past_newline (void)
|
||||||
{
|
{
|
||||||
idx = skip_past_newline_1 (ptr, idx);
|
idx = skip_past_newline_1 (ptr, idx);
|
||||||
pc++;
|
pc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
internalmode ()
|
internalmode (void)
|
||||||
{
|
{
|
||||||
internal_mode = *(isp);
|
internal_mode = *(isp);
|
||||||
isp--;
|
isp--;
|
||||||
@ -1123,7 +1036,7 @@ internalmode ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybecatstr ()
|
maybecatstr (void)
|
||||||
{
|
{
|
||||||
if (internal_wanted == internal_mode)
|
if (internal_wanted == internal_mode)
|
||||||
{
|
{
|
||||||
@ -1136,9 +1049,7 @@ maybecatstr ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nextword (string, word)
|
nextword (char *string, char **word)
|
||||||
char *string;
|
|
||||||
char **word;
|
|
||||||
{
|
{
|
||||||
char *word_start;
|
char *word_start;
|
||||||
int idx;
|
int idx;
|
||||||
@ -1226,8 +1137,7 @@ nextword (string, word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dict_type *
|
dict_type *
|
||||||
lookup_word (word)
|
lookup_word (char *word)
|
||||||
char *word;
|
|
||||||
{
|
{
|
||||||
dict_type *ptr = root;
|
dict_type *ptr = root;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
@ -1304,8 +1214,7 @@ perform (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dict_type *
|
dict_type *
|
||||||
newentry (word)
|
newentry (char *word)
|
||||||
char *word;
|
|
||||||
{
|
{
|
||||||
dict_type *new_d = (dict_type *) malloc (sizeof (dict_type));
|
dict_type *new_d = (dict_type *) malloc (sizeof (dict_type));
|
||||||
new_d->word = word;
|
new_d->word = word;
|
||||||
@ -1318,9 +1227,7 @@ newentry (word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
add_to_definition (entry, word)
|
add_to_definition (dict_type *entry, stinst_type word)
|
||||||
dict_type *entry;
|
|
||||||
stinst_type word;
|
|
||||||
{
|
{
|
||||||
if (entry->code_end == entry->code_length)
|
if (entry->code_end == entry->code_length)
|
||||||
{
|
{
|
||||||
@ -1335,9 +1242,7 @@ add_to_definition (entry, word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_intrinsic (name, func)
|
add_intrinsic (char *name, void (*func) (void))
|
||||||
char *name;
|
|
||||||
void (*func) ();
|
|
||||||
{
|
{
|
||||||
dict_type *new_d = newentry (strdup (name));
|
dict_type *new_d = newentry (strdup (name));
|
||||||
add_to_definition (new_d, func);
|
add_to_definition (new_d, func);
|
||||||
@ -1345,8 +1250,7 @@ add_intrinsic (name, func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
compile (string)
|
compile (char *string)
|
||||||
char *string;
|
|
||||||
{
|
{
|
||||||
/* Add words to the dictionary. */
|
/* Add words to the dictionary. */
|
||||||
char *word;
|
char *word;
|
||||||
@ -1419,7 +1323,7 @@ compile (string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bang ()
|
bang (void)
|
||||||
{
|
{
|
||||||
*(long *) ((isp[0])) = isp[-1];
|
*(long *) ((isp[0])) = isp[-1];
|
||||||
isp -= 2;
|
isp -= 2;
|
||||||
@ -1428,21 +1332,21 @@ bang ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
atsign ()
|
atsign (void)
|
||||||
{
|
{
|
||||||
isp[0] = *(long *) (isp[0]);
|
isp[0] = *(long *) (isp[0]);
|
||||||
pc++;
|
pc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hello ()
|
hello (void)
|
||||||
{
|
{
|
||||||
printf ("hello\n");
|
printf ("hello\n");
|
||||||
pc++;
|
pc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stdout_ ()
|
stdout_ (void)
|
||||||
{
|
{
|
||||||
isp++;
|
isp++;
|
||||||
icheck_range ();
|
icheck_range ();
|
||||||
@ -1451,7 +1355,7 @@ stdout_ ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stderr_ ()
|
stderr_ (void)
|
||||||
{
|
{
|
||||||
isp++;
|
isp++;
|
||||||
icheck_range ();
|
icheck_range ();
|
||||||
@ -1460,7 +1364,7 @@ stderr_ ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print ()
|
print (void)
|
||||||
{
|
{
|
||||||
if (*isp == 1)
|
if (*isp == 1)
|
||||||
write_buffer (tos, stdout);
|
write_buffer (tos, stdout);
|
||||||
@ -1476,9 +1380,7 @@ print ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_in (str, file)
|
read_in (string_type *str, FILE *file)
|
||||||
string_type *str;
|
|
||||||
FILE *file;
|
|
||||||
{
|
{
|
||||||
char buff[10000];
|
char buff[10000];
|
||||||
unsigned int r;
|
unsigned int r;
|
||||||
@ -1494,7 +1396,7 @@ read_in (str, file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage ()
|
usage (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "usage: -[d|i|g] <file >file\n");
|
fprintf (stderr, "usage: -[d|i|g] <file >file\n");
|
||||||
exit (33);
|
exit (33);
|
||||||
@ -1506,15 +1408,13 @@ usage ()
|
|||||||
is a pointless waste of time. */
|
is a pointless waste of time. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
chew_exit ()
|
chew_exit (void)
|
||||||
{
|
{
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (ac, av)
|
main (int ac, char *av[])
|
||||||
int ac;
|
|
||||||
char *av[];
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
string_type buffer;
|
string_type buffer;
|
||||||
|
Reference in New Issue
Block a user