ANSIfication] Another batch.
This commit is contained in:
committed by
Manoël Trapier
parent
3d1d1277b7
commit
0946773758
@@ -37,16 +37,13 @@ extern arith char_constant();
|
||||
#define FLG_ESEEN 0x01 /* possibly a floating point number */
|
||||
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
||||
|
||||
int
|
||||
LLlex()
|
||||
int LLlex()
|
||||
{
|
||||
return (DOT != EOF) ? GetToken(&dot) : EOF;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GetToken(ptok)
|
||||
register struct token *ptok;
|
||||
int GetToken(struct token *ptok)
|
||||
{
|
||||
/* GetToken() is the actual token recognizer. It calls the
|
||||
control line interpreter if it encounters a "\n{w}*#"
|
||||
@@ -325,9 +322,10 @@ garbage:
|
||||
crash("bad class for char 0%o", ch);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
skipcomment()
|
||||
void skipcomment()
|
||||
{
|
||||
/* The last character read has been the '*' of '/_*'. The
|
||||
characters, except NL and EOI, between '/_*' and the first
|
||||
@@ -358,9 +356,7 @@ skipcomment()
|
||||
NoUnstack--;
|
||||
}
|
||||
|
||||
arith
|
||||
char_constant(nm)
|
||||
char *nm;
|
||||
arith char_constant(char *nm)
|
||||
{
|
||||
register arith val = 0;
|
||||
register int ch;
|
||||
@@ -391,9 +387,7 @@ char_constant(nm)
|
||||
return val;
|
||||
}
|
||||
|
||||
char *
|
||||
string_token(nm, stop_char)
|
||||
char *nm;
|
||||
char *string_token(char *nm, int stop_char)
|
||||
{
|
||||
register int ch;
|
||||
register int str_size;
|
||||
@@ -423,9 +417,7 @@ string_token(nm, stop_char)
|
||||
return str;
|
||||
}
|
||||
|
||||
int
|
||||
quoted(ch)
|
||||
register int ch;
|
||||
int quoted(int ch)
|
||||
{
|
||||
/* quoted() replaces an escaped character sequence by the
|
||||
character meant.
|
||||
@@ -483,9 +475,7 @@ quoted(ch)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
val_in_base(ch, base)
|
||||
register int ch;
|
||||
int val_in_base(int ch, int base)
|
||||
{
|
||||
switch (base) {
|
||||
case 8:
|
||||
@@ -500,11 +490,11 @@ val_in_base(ch, base)
|
||||
fatal("(val_in_base) illegal base value %d", base);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GetChar()
|
||||
int GetChar()
|
||||
{
|
||||
/* The routines GetChar and trigraph parses the trigraph
|
||||
sequences and removes occurences of \\\n.
|
||||
@@ -532,8 +522,7 @@ again:
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trigraph()
|
||||
int trigraph()
|
||||
{
|
||||
register int ch;
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ extern int NoUnstack; /* buffer.c */
|
||||
|
||||
extern int err_occurred; /* "error.c" */
|
||||
|
||||
|
||||
void skipcomment();
|
||||
|
||||
#define DOT dot.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
|
||||
extern char *symbol2str();
|
||||
|
||||
LLmessage(tk) {
|
||||
void LLmessage(int tk)
|
||||
{
|
||||
if (tk < 0)
|
||||
error("garbage at end of line");
|
||||
else if (tk) {
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
|
||||
|
||||
!File: botch_free.h
|
||||
/*#define BOTCH_FREE 1 /* botch freed memory, as a check */
|
||||
/*#define BOTCH_FREE 1*/ /* botch freed memory, as a check */
|
||||
|
||||
|
||||
!File: debug.h
|
||||
/*#define DEBUG 1 /* perform various self-tests */
|
||||
/*#define DEBUG 1*/ /* perform various self-tests */
|
||||
#define NDEBUG 1 /* disable assertions */
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
!File: inputtype.h
|
||||
/*#define INP_READ_IN_ONE 1 /* read input file in one. */
|
||||
/*#define INP_READ_IN_ONE 1*/ /* read input file in one. */
|
||||
/* If defined, we cannot read from a pipe */
|
||||
|
||||
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
|
||||
#define arith_sign (1L << (sizeof(arith)*8-1))
|
||||
|
||||
ch3bin(pval, pis_uns, oper, val, is_uns)
|
||||
register arith *pval, val;
|
||||
int oper, is_uns, *pis_uns;
|
||||
void ch3bin(arith *pval, int *pis_uns, int oper, arith val, int is_uns)
|
||||
{
|
||||
if (is_uns) *pis_uns = 1;
|
||||
switch (oper) {
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#include "arith.h"
|
||||
|
||||
/*ARGSUSED2*/
|
||||
ch3mon(oper, pval, puns)
|
||||
register arith *pval;
|
||||
int *puns;
|
||||
void ch3mon(int oper, arith *pval, int *puns)
|
||||
{
|
||||
switch (oper) {
|
||||
case '~':
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
/* $Id$ */
|
||||
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "arith.h"
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
@@ -26,21 +28,35 @@
|
||||
#include "macbuf.h"
|
||||
#include "replace.h"
|
||||
|
||||
char *getwdir(char *fn); /* /util/cpp/input.c */
|
||||
|
||||
extern char options[];
|
||||
extern char **inctable; /* list of include directories */
|
||||
extern char *getwdir();
|
||||
char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
||||
/* 1 if a corresponding ELSE has been */
|
||||
/* encountered. */
|
||||
|
||||
void do_include();
|
||||
void do_define();
|
||||
void do_elif();
|
||||
void push_if();
|
||||
void do_else();
|
||||
void do_endif();
|
||||
void do_if();
|
||||
void do_ifdef(int how);
|
||||
void do_undef(char *argstr);
|
||||
void do_error();
|
||||
void do_line(unsigned int l);
|
||||
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags);
|
||||
|
||||
int nestlevel = -1;
|
||||
int svnestlevel[30] = {-1};
|
||||
int nestcount;
|
||||
extern int do_preprocess;
|
||||
|
||||
char *
|
||||
GetIdentifier(skiponerr)
|
||||
int skiponerr; /* skip the rest of the line on error */
|
||||
/* skiponerr => skip the rest of the line on error */
|
||||
char *GetIdentifier(int skiponerr)
|
||||
{
|
||||
/* Returns a pointer to the identifier that is read from the
|
||||
input stream. When the input does not contain an
|
||||
@@ -73,7 +89,7 @@ GetIdentifier(skiponerr)
|
||||
Pragma's are handled by do_pragma(). They are passed on to the
|
||||
compiler.
|
||||
*/
|
||||
domacro()
|
||||
void domacro()
|
||||
{
|
||||
struct token tk; /* the token itself */
|
||||
register struct idf *id;
|
||||
@@ -154,8 +170,7 @@ domacro()
|
||||
}
|
||||
}
|
||||
|
||||
skip_block(to_endif)
|
||||
int to_endif;
|
||||
void skip_block(int to_endif)
|
||||
{
|
||||
/* skip_block() skips the input from
|
||||
1) a false #if, #ifdef, #ifndef or #elif until the
|
||||
@@ -275,7 +290,7 @@ int to_endif;
|
||||
}
|
||||
|
||||
|
||||
ifexpr()
|
||||
int ifexpr()
|
||||
{
|
||||
/* ifexpr() returns whether the restricted constant
|
||||
expression following #if or #elif evaluates to true. This
|
||||
@@ -296,7 +311,7 @@ ifexpr()
|
||||
return (errors == err_occurred) && (ifval != (arith)0);
|
||||
}
|
||||
|
||||
do_include()
|
||||
void do_include()
|
||||
{
|
||||
/* do_include() performs the inclusion of a file.
|
||||
*/
|
||||
@@ -333,7 +348,7 @@ do_include()
|
||||
}
|
||||
}
|
||||
|
||||
do_define()
|
||||
void do_define()
|
||||
{
|
||||
/* do_define() interprets a #define control line.
|
||||
*/
|
||||
@@ -373,7 +388,7 @@ do_define()
|
||||
LineNumber++;
|
||||
}
|
||||
|
||||
push_if()
|
||||
void push_if()
|
||||
{
|
||||
if (nestlevel >= IFDEPTH)
|
||||
fatal("too many nested #if/#ifdef/#ifndef");
|
||||
@@ -381,7 +396,7 @@ push_if()
|
||||
ifstack[++nestlevel] = 0;
|
||||
}
|
||||
|
||||
do_elif()
|
||||
void do_elif()
|
||||
{
|
||||
if (nestlevel <= svnestlevel[nestcount]) {
|
||||
error("#elif without corresponding #if");
|
||||
@@ -398,7 +413,7 @@ do_elif()
|
||||
}
|
||||
}
|
||||
|
||||
do_else()
|
||||
void do_else()
|
||||
{
|
||||
if (SkipToNewLine()) {
|
||||
if (!options['o'])
|
||||
@@ -415,7 +430,7 @@ do_else()
|
||||
}
|
||||
}
|
||||
|
||||
do_endif()
|
||||
void do_endif()
|
||||
{
|
||||
if (SkipToNewLine()) {
|
||||
if (!options['o'])
|
||||
@@ -427,14 +442,14 @@ do_endif()
|
||||
else nestlevel--;
|
||||
}
|
||||
|
||||
do_if()
|
||||
void do_if()
|
||||
{
|
||||
push_if();
|
||||
if (!ifexpr()) /* a false #if/#elif expression */
|
||||
skip_block(0);
|
||||
}
|
||||
|
||||
do_ifdef(how)
|
||||
void do_ifdef(int how)
|
||||
{
|
||||
register struct idf *id;
|
||||
register char *str;
|
||||
@@ -463,8 +478,7 @@ do_ifdef(how)
|
||||
}
|
||||
|
||||
/* argstr != NULL when the undef came from a -U option */
|
||||
do_undef(argstr)
|
||||
char *argstr;
|
||||
void do_undef(char *argstr)
|
||||
{
|
||||
register struct idf *id;
|
||||
register char *str = argstr;
|
||||
@@ -492,7 +506,7 @@ do_undef(argstr)
|
||||
error("illegal #undef construction");
|
||||
}
|
||||
|
||||
do_error()
|
||||
void do_error()
|
||||
{
|
||||
int len;
|
||||
char *get_text();
|
||||
@@ -503,10 +517,7 @@ do_error()
|
||||
LineNumber++;
|
||||
}
|
||||
|
||||
int
|
||||
getparams(buf, parbuf)
|
||||
char *buf[];
|
||||
char parbuf[];
|
||||
int getparams(char *buf[], char parbuf[])
|
||||
{
|
||||
/* getparams() reads the formal parameter list of a macro
|
||||
definition.
|
||||
@@ -570,11 +581,10 @@ getparams(buf, parbuf)
|
||||
c = skipspaces(c,0);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
macro_def(id, text, nformals, length, flags)
|
||||
register struct idf *id;
|
||||
char *text;
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags)
|
||||
{
|
||||
register struct macro *newdef = id->id_macro;
|
||||
|
||||
@@ -613,9 +623,7 @@ macro_def(id, text, nformals, length, flags)
|
||||
newdef->mc_flag = flags; /* special flags */
|
||||
}
|
||||
|
||||
int
|
||||
find_name(nm, index)
|
||||
char *nm, *index[];
|
||||
int find_name(char *nm, char *index[])
|
||||
{
|
||||
/* find_name() returns the index of "nm" in the namelist
|
||||
"index" if it can be found there. 0 is returned if it is
|
||||
@@ -632,10 +640,7 @@ find_name(nm, index)
|
||||
|
||||
#define BLANK(ch) ((ch == ' ') || (ch == '\t'))
|
||||
|
||||
char *
|
||||
get_text(formals, length)
|
||||
char *formals[];
|
||||
int *length;
|
||||
char *get_text(char *formals[], int *length)
|
||||
{
|
||||
/* get_text() copies the replacement text of a macro
|
||||
definition with zero, one or more parameters, thereby
|
||||
@@ -726,7 +731,7 @@ get_text(formals, length)
|
||||
add2repl(repl, ' ');
|
||||
}
|
||||
/* construct the formal parameter mark or identifier */
|
||||
if (n = find_name(id_buf, formals))
|
||||
if ( (n = find_name(id_buf, formals)) )
|
||||
add2repl(repl, FORMALP | (char) n);
|
||||
else {
|
||||
idp = id_buf;
|
||||
@@ -775,8 +780,7 @@ get_text(formals, length)
|
||||
as strings, without taking care of the leading and trailing
|
||||
blanks (spaces and tabs).
|
||||
*/
|
||||
macroeq(s, t)
|
||||
register char *s, *t;
|
||||
int macroeq(char *s, char *t)
|
||||
{
|
||||
|
||||
/* skip leading spaces */
|
||||
@@ -798,8 +802,7 @@ macroeq(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
do_line(l)
|
||||
unsigned int l;
|
||||
void do_line(unsigned int l)
|
||||
{
|
||||
struct token tk;
|
||||
int t = GetToken(&tk);
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
int err_occurred;
|
||||
|
||||
err_hdr(s)
|
||||
char *s;
|
||||
void err_hdr(char *s)
|
||||
{
|
||||
if (FileName) {
|
||||
fprint(ERROUT, "\"%s\", line %d: %s", FileName, (int)LineNumber, s);
|
||||
@@ -34,7 +33,7 @@ err_hdr(s)
|
||||
|
||||
#if __STDC__
|
||||
/*VARARGS*/
|
||||
error(char *fmt, ...)
|
||||
void error(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -47,7 +46,7 @@ error(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
warning(char *fmt, ...)
|
||||
void warning(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -59,7 +58,7 @@ warning(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
strict(char *fmt, ...)
|
||||
void strict(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -71,7 +70,7 @@ strict(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
crash(char *fmt, ...)
|
||||
void crash(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -84,7 +83,7 @@ crash(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
fatal(char *fmt, ...)
|
||||
void fatal(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ struct mkey {
|
||||
//char *strcpy();
|
||||
//char *sprint();
|
||||
|
||||
init_pp()
|
||||
void init_pp()
|
||||
{
|
||||
static char *months[12] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
@@ -74,7 +74,7 @@ init_pp()
|
||||
/* __DATE__ */
|
||||
sprint(dbuf, "\"%s %2d %d\"", months[tp->tm_mon],
|
||||
tp->tm_mday, tp->tm_year+1900);
|
||||
/* if (tp->tm_mday < 10) dbuf[5] = ' '; /* hack */
|
||||
/* if (tp->tm_mday < 10) dbuf[5] = ' ';*/ /* hack */
|
||||
macro_def(str2idf("__DATE__", 0), dbuf, -1, strlen(dbuf), NOUNDEF);
|
||||
|
||||
/* __TIME__ */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <alloc.h>
|
||||
#include <assert.h>
|
||||
#include <system.h>
|
||||
#include <string.h>
|
||||
#include "arith.h"
|
||||
#include "file_info.h"
|
||||
#include "idfsize.h"
|
||||
@@ -32,8 +33,13 @@ char *prog_name;
|
||||
extern char **inctable;
|
||||
extern int inc_max, inc_total;
|
||||
|
||||
main(argc, argv)
|
||||
char *argv[];
|
||||
|
||||
void compile(int argc, char *argv[]);
|
||||
void list_dependencies(char *source);
|
||||
void dependency(char *s, char *source);
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/* parse and interpret the command line options */
|
||||
prog_name = argv[0];
|
||||
@@ -61,11 +67,12 @@ main(argc, argv)
|
||||
}
|
||||
compile(argc - 1, &argv[1]);
|
||||
sys_stop(err_occurred ? S_EXIT : S_END);
|
||||
|
||||
/*NOTREACHED*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
compile(argc, argv)
|
||||
char *argv[];
|
||||
void compile(int argc, char *argv[])
|
||||
{
|
||||
register char *source = 0;
|
||||
char *dummy;
|
||||
@@ -94,10 +101,8 @@ compile(argc, argv)
|
||||
}
|
||||
|
||||
struct idf *file_head;
|
||||
extern char *strrchr();
|
||||
|
||||
list_dependencies(source)
|
||||
char *source;
|
||||
void list_dependencies(char *source)
|
||||
{
|
||||
register struct idf *p = file_head;
|
||||
|
||||
@@ -112,7 +117,7 @@ list_dependencies(source)
|
||||
* object generated, so don't include the pathname
|
||||
* leading to it.
|
||||
*/
|
||||
if (s = strrchr(source, '/')) {
|
||||
if ( (s = strrchr(source, '/')) ) {
|
||||
source = s + 1;
|
||||
}
|
||||
}
|
||||
@@ -128,8 +133,7 @@ list_dependencies(source)
|
||||
}
|
||||
}
|
||||
|
||||
add_dependency(s)
|
||||
char *s;
|
||||
void add_dependency(char *s)
|
||||
{
|
||||
register struct idf *p = str2idf(s, 0);
|
||||
|
||||
@@ -140,8 +144,7 @@ add_dependency(s)
|
||||
}
|
||||
}
|
||||
|
||||
dependency(s, source)
|
||||
char *s, *source;
|
||||
void dependency(char *s, char *source)
|
||||
{
|
||||
if (options['i'] && !strncmp(s, "/usr/include/", 13)) {
|
||||
return;
|
||||
@@ -152,8 +155,7 @@ dependency(s, source)
|
||||
else fprint(dep_fd, "%s\n", s);
|
||||
}
|
||||
|
||||
void
|
||||
No_Mem() /* called by alloc package */
|
||||
void No_Mem() /* called by alloc package */
|
||||
{
|
||||
fatal("out of memory");
|
||||
}
|
||||
|
||||
@@ -23,10 +23,8 @@ char **inctable;
|
||||
char *dep_file = 0;
|
||||
|
||||
extern int idfsize;
|
||||
int txt2int();
|
||||
|
||||
do_option(text)
|
||||
char *text;
|
||||
void do_option(char *text)
|
||||
{
|
||||
switch(*text++) {
|
||||
case '-':
|
||||
@@ -127,9 +125,7 @@ do_option(text)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
txt2int(tp)
|
||||
char **tp;
|
||||
int txt2int(char **tp)
|
||||
{
|
||||
/* the integer pointed to by *tp is read, while increasing
|
||||
*tp; the resulting value is yielded.
|
||||
|
||||
@@ -29,12 +29,11 @@ extern int InputLevel;
|
||||
|
||||
extern char *sprint();
|
||||
|
||||
Xflush()
|
||||
void Xflush()
|
||||
{
|
||||
sys_write(STDOUT, _obuf, OBUFSIZE);
|
||||
}
|
||||
|
||||
static char *SkipComment();
|
||||
extern char options[];
|
||||
|
||||
/* #pragma directives are saved here and passed to the compiler later on.
|
||||
@@ -47,7 +46,10 @@ struct prag_info {
|
||||
static struct prag_info *pragma_tab;
|
||||
static int pragma_nr;
|
||||
|
||||
do_pragma()
|
||||
static char *SkipComment(char *op, int *lineno);
|
||||
void preprocess(char *fn);
|
||||
|
||||
void do_pragma()
|
||||
{
|
||||
register int size = ITEXTSIZE;
|
||||
char *cur_line = Malloc((unsigned)size);
|
||||
@@ -105,8 +107,7 @@ do_pragma()
|
||||
|
||||
char Xbuf[256];
|
||||
|
||||
preprocess(fn)
|
||||
char *fn;
|
||||
void preprocess(char *fn)
|
||||
{
|
||||
register int c;
|
||||
register char *op = _obuf;
|
||||
@@ -409,10 +410,7 @@ preprocess(fn)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
static char *
|
||||
SkipComment(op, lineno)
|
||||
char *op;
|
||||
int *lineno;
|
||||
static char *SkipComment(char *op, int *lineno)
|
||||
{
|
||||
char *ob = &_obuf[OBUFSIZE];
|
||||
register int c, oldc = '\0';
|
||||
|
||||
@@ -26,15 +26,19 @@
|
||||
#include "macbuf.h"
|
||||
#include "replace.h"
|
||||
|
||||
//extern char *GetIdentifier();
|
||||
//extern char *strcpy();
|
||||
//extern char *strcat();
|
||||
extern int InputLevel;
|
||||
struct repl *ReplaceList; /* list of currently active macros */
|
||||
|
||||
int
|
||||
replace(idf)
|
||||
register struct idf *idf;
|
||||
void expand_defined(struct repl *repl);
|
||||
void getactuals(struct repl *repl, struct idf *idf);
|
||||
void macro_func(struct idf *idef);
|
||||
void macro2buffer(struct repl *repl, struct idf *idf, struct args *args);
|
||||
void add2repl(struct repl *repl, int ch);
|
||||
void stash(struct repl *repl, int ch, int stashraw);
|
||||
|
||||
char *GetIdentifier(int skiponerr); /* domacro.c */
|
||||
|
||||
int replace(struct idf *idf)
|
||||
{
|
||||
/* replace is called by the lexical analyzer to perform
|
||||
macro replacement. The routine actualy functions as a
|
||||
@@ -60,13 +64,12 @@ replace(idf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
unstackrepl()
|
||||
void unstackrepl()
|
||||
{
|
||||
Unstacked++;
|
||||
}
|
||||
|
||||
freeargs(args)
|
||||
struct args *args;
|
||||
void freeargs(struct args *args)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -84,7 +87,7 @@ freeargs(args)
|
||||
free_args(args);
|
||||
}
|
||||
|
||||
EnableMacros()
|
||||
void EnableMacros()
|
||||
{
|
||||
register struct repl *r = ReplaceList, *prev = 0;
|
||||
|
||||
@@ -106,9 +109,7 @@ EnableMacros()
|
||||
Unstacked = 0;
|
||||
}
|
||||
|
||||
expand_macro(repl, idf)
|
||||
register struct repl *repl;
|
||||
register struct idf *idf;
|
||||
int expand_macro(struct repl *repl, struct idf *idf)
|
||||
{
|
||||
/* expand_macro() does the actual macro replacement.
|
||||
"idf" is a description of the identifier which
|
||||
@@ -171,8 +172,7 @@ expand_macro(repl, idf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
expand_defined(repl)
|
||||
register struct repl *repl;
|
||||
void expand_defined(struct repl *repl)
|
||||
{
|
||||
register int ch = GetChar();
|
||||
struct idf *id;
|
||||
@@ -207,16 +207,13 @@ expand_defined(repl)
|
||||
add2repl(repl, ' ');
|
||||
}
|
||||
|
||||
newarg(args)
|
||||
struct args *args;
|
||||
void newarg(struct args *args)
|
||||
{
|
||||
args->a_expptr = args->a_expbuf = Malloc((unsigned)(args->a_expsize = ARGBUF));
|
||||
args->a_rawptr = args->a_rawbuf = Malloc((unsigned)(args->a_rawsize = ARGBUF));
|
||||
}
|
||||
|
||||
getactuals(repl, idf)
|
||||
struct repl *repl;
|
||||
register struct idf *idf;
|
||||
void getactuals(struct repl *repl, struct idf *idf)
|
||||
{
|
||||
/* Get the actual parameters from the input stream.
|
||||
The hard part is done by actual(), only comma's and
|
||||
@@ -257,8 +254,7 @@ getactuals(repl, idf)
|
||||
error("too many macro arguments");
|
||||
}
|
||||
|
||||
saveraw(repl)
|
||||
struct repl *repl;
|
||||
void saveraw(struct repl *repl)
|
||||
{
|
||||
register struct repl *nrepl = ReplaceList;
|
||||
register struct args *ap = nrepl->r_args;
|
||||
@@ -295,9 +291,7 @@ struct repl *repl;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
actual(repl)
|
||||
struct repl *repl;
|
||||
int actual(struct repl *repl)
|
||||
{
|
||||
/* This routine deals with the scanning of an actual parameter.
|
||||
It keeps in account the opening and closing brackets,
|
||||
@@ -498,8 +492,7 @@ a_new_line: ch = GetChar();
|
||||
}
|
||||
}
|
||||
|
||||
macro_func(idef)
|
||||
register struct idf *idef;
|
||||
void macro_func(struct idf *idef)
|
||||
{
|
||||
/* macro_func() performs the special actions needed with some
|
||||
macros. These macros are __FILE__ and __LINE__ which
|
||||
@@ -528,10 +521,7 @@ macro_func(idef)
|
||||
}
|
||||
}
|
||||
|
||||
macro2buffer(repl, idf, args)
|
||||
register struct repl *repl;
|
||||
register struct idf *idf;
|
||||
register struct args *args;
|
||||
void macro2buffer(struct repl *repl, struct idf *idf, struct args *args)
|
||||
{
|
||||
/* macro2buffer expands the replacement list and places the
|
||||
result onto the replacement buffer. It deals with the #
|
||||
@@ -681,11 +671,7 @@ macro2buffer(repl, idf, args)
|
||||
error("illegal use of ## operator");
|
||||
}
|
||||
|
||||
char *
|
||||
stringify(repl, ptr, args)
|
||||
register struct repl *repl;
|
||||
register char *ptr;
|
||||
register struct args *args;
|
||||
char *stringify(struct repl *repl, char *ptr, struct args *args)
|
||||
{
|
||||
/* If a parameter is immediately preceded by a # token
|
||||
both are replaced by a single string literal that
|
||||
@@ -748,9 +734,7 @@ stringify(repl, ptr, args)
|
||||
|
||||
/* The following routine is also called from domacro.c.
|
||||
*/
|
||||
add2repl(repl, ch)
|
||||
register struct repl *repl;
|
||||
int ch;
|
||||
void add2repl(struct repl *repl, int ch)
|
||||
{
|
||||
register int index = repl->r_ptr - repl->r_text;
|
||||
|
||||
@@ -767,10 +751,7 @@ add2repl(repl, ch)
|
||||
* buffer. If the variable is zero, we must only stash into the expanded
|
||||
* buffer. Otherwise, we must use both buffers.
|
||||
*/
|
||||
stash(repl, ch, stashraw)
|
||||
struct repl *repl;
|
||||
register int ch;
|
||||
int stashraw;
|
||||
void stash(struct repl *repl, int ch, int stashraw)
|
||||
{
|
||||
/* Stash characters into the macro expansion buffer.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user