+++ /dev/null
-/* ANSI and traditional C compatability macros
- Copyright 1991 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* ANSI and traditional C compatibility macros
-
- Some ANSI environments are "broken" in the sense that __STDC__ cannot be
- relied upon to have it's intended meaning. Therefore we must use our own
- concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib
- sources!
-
- ANSI C is assumed if _HAVE_STDC is #defined.
-
- Macro ANSI C definition Traditional C definition
- ----- ---- - ---------- ----------- - ----------
- PTR `void *' `char *'
- LONG_DOUBLE `long double' `double'
- CONST `const' `'
- VOLATILE `volatile' `'
- SIGNED `signed' `'
- PTRCONST `void *const' `char *'
-
- DEFUN(name, arglist, args)
-
- Defines function NAME.
-
- ARGLIST lists the arguments, separated by commas and enclosed in
- parentheses. ARGLIST becomes the argument list in traditional C.
-
- ARGS list the arguments with their types. It becomes a prototype in
- ANSI C, and the type declarations in traditional C. Arguments should
- be separated with `AND'. For functions with a variable number of
- arguments, the last thing listed should be `DOTS'.
-
- DEFUN_VOID(name)
-
- Defines a function NAME, which takes no arguments.
-
- EXFUN(name, prototype)
-
- Is used in an external function declaration.
- In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
- parentheses). In traditional C it is `NAME()'.
- For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
-
- For example:
- extern int EXFUN(printf, (CONST char *format DOTS));
- int DEFUN(fprintf, (stream, format),
- FILE *stream AND CONST char *format DOTS) { ... }
- void DEFUN_VOID(abort) { ... }
-*/
-
-#ifndef _ANSIDECL_H
-
-#define _ANSIDECL_H 1
-
-
-/* Every source file includes this file,
- so they will all get the switch for lint. */
-/* LINTLIBRARY */
-
-
-
-#define PTR void *
-#define PTRCONST void *CONST
-#define LONG_DOUBLE long double
-
-#define AND ,
-#define NOARGS void
-#define CONST const
-#define VOLATILE volatile
-#define SIGNED signed
-#define DOTS , ...
-
-#define EXFUN(name, proto) name proto
-#define DEFUN(name, arglist, args) name(args)
-#define DEFUN_VOID(name) name(NOARGS)
-
-
-
-#endif /* ansidecl.h */
-#include "ansidecl.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-static void DEFUN(init_string_with_size,(buffer, size),
- string_type *buffer AND
- unsigned int size )
+static void
+init_string_with_size (string_type *buffer, unsigned int size)
{
buffer->write_idx = 0;
buffer->size = size;
buffer->ptr = malloc(size);
}
-static void DEFUN(init_string,(buffer),
- string_type *buffer)
+static void
+init_string (string_type *buffer)
{
init_string_with_size(buffer, DEF_SIZE);
}
-static int DEFUN(find, (str, what),
- string_type *str AND
- char *what)
+static int
+find (string_type *str, char *what)
{
unsigned int i;
char *p;
}
-static void DEFUN(write_buffer,(buffer),
- string_type *buffer)
+static void
+write_buffer (string_type *buffer)
{
fwrite(buffer->ptr, buffer->write_idx, 1, stdout);
}
-static void DEFUN(delete_string,(buffer),
- string_type *buffer)
+static void
+delete_string (string_type *buffer)
{
free(buffer->ptr);
}
-static char *DEFUN(addr, (buffer, idx),
- string_type *buffer AND
- unsigned int idx)
+static char *
+addr (string_type *buffer, unsigned int idx)
{
return buffer->ptr + idx;
}
-static char DEFUN(at,(buffer, pos),
- string_type *buffer AND
- unsigned int pos)
+static char
+at (string_type *buffer, unsigned int pos)
{
if ( pos >= buffer->write_idx)
{
return buffer->ptr[pos];
}
-static void DEFUN(catchar,(buffer, ch),
- string_type *buffer AND
- char ch)
+static void
+catchar (string_type *buffer, char ch)
{
if (buffer->write_idx == buffer->size)
{
}
-static void DEFUN(overwrite_string,(dst, src),
- string_type *dst AND
- string_type *src)
+static void
+overwrite_string (string_type *dst, string_type *src)
{
free(dst->ptr);
dst->size = src->size;
dst->ptr = src->ptr;
}
-static void DEFUN(catstr,(dst, src),
- string_type *dst AND
- string_type *src)
+static void
+catstr (string_type *dst, string_type *src)
{
unsigned int i;
for (i = 0; i < src->write_idx; i++)
}
-static void DEFUN(cattext,(buffer, string),
- string_type *buffer AND
- char *string)
+static void
+cattext (string_type *buffer, char *string)
{
while (*string)
}
}
-static void DEFUN(catbuf,(buffer, buf, len),
- string_type *buffer AND
- char *buf AND
- unsigned int len)
+static void
+catbuf (string_type *buffer, char *buf, unsigned int len)
{
while (len--)
static unsigned int
-DEFUN(skip_white_and_stars,(src, idx),
- string_type *src AND
- unsigned int idx)
+skip_white_and_stars (string_type *src, unsigned int idx)
{
while (isspace(at(src,idx))
|| (at(src,idx) == '*' && at(src,idx +1) !='/'))
unsigned int idx = 0; /* Pos in input buffer */
string_type *ptr; /* and the buffer */
-typedef void (*stinst_type)(NOARGS);
+typedef void (*stinst_type)(void);
stinst_type *pc;
stinst_type sstack[STACK];
stinst_type *ssp = &sstack[0];
};
typedef struct dict_struct dict_type;
-#define WORD(x) static void x(NOARGS)
+#define WORD(x) static void x(void)
-static void DEFUN(exec,(word),
- dict_type *word)
+static void
+exec (dict_type *word)
{
pc = word->code;
while (*pc)
*/
static void
-DEFUN(remove_noncomments,(src,dst),
- string_type *src AND
- string_type *dst)
+remove_noncomments (string_type *src, string_type *dst)
{
unsigned int idx = 0;
*/
static void
-DEFUN_VOID(exfunstuff)
+exfunstuff (void)
{
unsigned int openp;
unsigned int fname;
/* Mod tos so that only lines with leading dots remain */
static void
-DEFUN_VOID(outputdots)
+outputdots (void)
{
unsigned int idx = 0;
string_type out;
}
/* A command is all upper case,and alone on a line */
static int
-DEFUN( iscommand,(ptr, idx),
- string_type *ptr AND
- unsigned int idx)
+iscommand (string_type *ptr, unsigned int idx)
{
unsigned int len = 0;
unsigned int
-DEFUN(copy_past_newline,(ptr, idx, dst),
- string_type *ptr AND
- unsigned int idx AND
- string_type *dst)
+copy_past_newline (string_type *ptr, unsigned int idx, string_type *dst)
{
while (at(ptr, idx) && at(ptr, idx) != '\n')
{
}
char *
-DEFUN(nextword,(string, word),
- char *string AND
- char **word)
+nextword (char *string, char **word)
{
char *word_start;
int idx;
}
dict_type *root;
dict_type *
-DEFUN(lookup_word,(word),
- char *word)
+lookup_word (char *word)
{
dict_type *ptr = root;
while (ptr) {
}
-static int DEFUN_VOID(perform)
+static int
+perform (void)
{
tos = stack;
int errors = 0;
}
dict_type *
-DEFUN(newentry,(word),
- char *word)
+newentry (char *word)
{
dict_type *new = (dict_type *)malloc(sizeof(dict_type));
new->word = word;
unsigned int
-DEFUN(add_to_definition,(entry, word),
- dict_type *entry AND
- stinst_type word)
+add_to_definition (dict_type *entry, stinst_type word)
{
if (entry->code_end == entry->code_length)
{
void
-DEFUN(add_intrinsic,(name, func),
- char *name AND
- void (*func)(NOARGS))
+add_intrinsic (char *name, void (*func)(void))
{
dict_type *new = newentry(name);
add_to_definition(new, func);
}
void
-DEFUN(add_var,(name),
- char *name)
+add_var (char *name)
{
dict_type *new = newentry(name);
add_to_definition(new, push_number);
int
-DEFUN(compile, (string),
- char *string)
-
+compile (char *string)
{
int ret=0;
/* add words to the dictionary */
}
-static void DEFUN_VOID(bang)
+static void
+bang (void)
{
*(uintptr_t *)((isp[0])) = isp[-1];
isp-=2;
-static void DEFUN(read_in, (str, file),
- string_type *str AND
- FILE *file)
+static void
+read_in (string_type *str, FILE *file)
{
char buff[10000];
unsigned int r;
#if 0
-static void DEFUN_VOID(usage)
+static void
+usage (void)
{
fprintf(stderr,"usage: -[i|v] -f macrofile <file >file\n");
exit(33);
}
#endif
-int DEFUN(main,(ac,av),
-int ac AND
-char *av[])
+int
+main (int ac, char *av[])
{
unsigned int i;
int status = 0;