ANSIfication] Another batch.
This commit is contained in:
committed by
Manoël Trapier
parent
3d1d1277b7
commit
0946773758
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
/* PREPROCESSOR: INITIALIZATION ROUTINES */
|
||||
|
||||
#include <string.h>
|
||||
#include <system.h>
|
||||
#include <alloc.h>
|
||||
#include "class.h"
|
||||
@@ -12,7 +13,7 @@
|
||||
#include "idf.h"
|
||||
#include "interface.h"
|
||||
|
||||
PRIVATE struct mkey {
|
||||
static struct mkey {
|
||||
char *mk_reserved;
|
||||
int mk_key;
|
||||
} mkey[] = {
|
||||
@@ -30,10 +31,7 @@ PRIVATE struct mkey {
|
||||
{0, K_UNKNOWN}
|
||||
};
|
||||
|
||||
char *strcpy();
|
||||
|
||||
EXPORT
|
||||
init_pp()
|
||||
void init_pp()
|
||||
{
|
||||
long clock, sys_time();
|
||||
static char date[30];
|
||||
|
||||
@@ -15,10 +15,9 @@ struct file_info finfo;
|
||||
#include <inp_pkg.body>
|
||||
#include <alloc.h>
|
||||
|
||||
char * getwdir(char *fn)
|
||||
char *getwdir(char *fn)
|
||||
{
|
||||
register char *p;
|
||||
char *strrchr();
|
||||
char *p;
|
||||
|
||||
p = strrchr(fn, '/');
|
||||
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
|
||||
@@ -42,7 +41,7 @@ int NoUnstack;
|
||||
int Unstacked;
|
||||
int InputLevel;
|
||||
|
||||
AtEoIT()
|
||||
int AtEoIT()
|
||||
{
|
||||
/* if (NoUnstack) warning("unexpected EOF"); ??? */
|
||||
/* This is wrong; in an #elif, NoUnstack can be set, but you
|
||||
@@ -53,7 +52,7 @@ AtEoIT()
|
||||
return 0;
|
||||
}
|
||||
|
||||
AtEoIF()
|
||||
int AtEoIF()
|
||||
{
|
||||
extern int nestlevel;
|
||||
extern int nestcount;
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#define PRIVATE
|
||||
#define PRIVATE
|
||||
#define IMPORT extern
|
||||
#define EXPORT
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
/* MAIN PROGRAM */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloc.h>
|
||||
#include <em_arith.h>
|
||||
#include <assert.h>
|
||||
@@ -26,13 +27,16 @@ static File *dep_fd = STDOUT;
|
||||
|
||||
arith ifval;
|
||||
|
||||
void compile(int argc, char *argv[]);
|
||||
void list_dependencies(char *source);
|
||||
void dependency(char *s, char *source);
|
||||
|
||||
char *prog_name;
|
||||
|
||||
extern char **inctable;
|
||||
extern int inc_max, inc_total;
|
||||
|
||||
main(argc, argv)
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/* parse and interpret the command line options */
|
||||
prog_name = argv[0];
|
||||
@@ -61,10 +65,10 @@ main(argc, argv)
|
||||
}
|
||||
compile(argc - 1, &argv[1]);
|
||||
exit(err_occurred);
|
||||
return 0;
|
||||
}
|
||||
|
||||
compile(argc, argv)
|
||||
char *argv[];
|
||||
void compile(int argc, char *argv[])
|
||||
{
|
||||
register char *source = 0;
|
||||
char *dummy;
|
||||
@@ -93,10 +97,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;
|
||||
|
||||
@@ -111,7 +113,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;
|
||||
}
|
||||
}
|
||||
@@ -127,8 +129,7 @@ list_dependencies(source)
|
||||
}
|
||||
}
|
||||
|
||||
add_dependency(s)
|
||||
char *s;
|
||||
void add_dependency(char *s)
|
||||
{
|
||||
register struct idf *p = str2idf(s, 0);
|
||||
|
||||
@@ -139,8 +140,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;
|
||||
|
||||
@@ -23,10 +23,9 @@ char **inctable;
|
||||
char *dep_file = 0;
|
||||
|
||||
extern int idfsize;
|
||||
int txt2int();
|
||||
int txt2int(char **tp);
|
||||
|
||||
do_option(text)
|
||||
char *text;
|
||||
void do_option(char *text)
|
||||
{
|
||||
switch(*text++) {
|
||||
case '-':
|
||||
@@ -130,9 +129,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.
|
||||
|
||||
@@ -22,12 +22,12 @@ char bits[128];
|
||||
char _obuf[OBUFSIZE];
|
||||
extern int do_preprocess;
|
||||
|
||||
Xflush()
|
||||
void Xflush()
|
||||
{
|
||||
if (do_preprocess) sys_write(STDOUT, _obuf, OBUFSIZE);
|
||||
}
|
||||
|
||||
preprocess(fn)
|
||||
void preprocess(fn)
|
||||
char *fn;
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -20,15 +20,18 @@
|
||||
#include "class.h"
|
||||
#include "interface.h"
|
||||
|
||||
char *strcpy(), *strcat();
|
||||
char *long2str();
|
||||
extern int InputLevel;
|
||||
|
||||
PRIVATE struct mlist *ReplList; /* list of currently active macros */
|
||||
static struct mlist *ReplList; /* list of currently active macros */
|
||||
static char *macro2buffer(struct idf *idef, char **actpars, int *siztext);
|
||||
static void macro_func(struct idf *idef);
|
||||
|
||||
EXPORT int
|
||||
replace(idef)
|
||||
register struct idf *idef;
|
||||
|
||||
char *GetIdentifier(); /* domacro.c */
|
||||
char **getactuals(struct idf *idef); /* scan.c */
|
||||
char *long2str(long value, int base); /* External lib */
|
||||
|
||||
int replace(struct idf *idef)
|
||||
{
|
||||
/* replace() is called by the lexical analyzer to perform
|
||||
macro replacement. "idef" is the description of the
|
||||
@@ -41,8 +44,8 @@ replace(idef)
|
||||
*/
|
||||
register struct macro *mac = idef->id_macro;
|
||||
register char c;
|
||||
char **actpars, **getactuals();
|
||||
char *reptext, *macro2buffer();
|
||||
char **actpars;
|
||||
char *reptext;
|
||||
register struct mlist *repl;
|
||||
int size;
|
||||
|
||||
@@ -79,7 +82,6 @@ replace(idef)
|
||||
if (mac->mc_flag & FUNC) {
|
||||
struct idf *param;
|
||||
char *nam;
|
||||
extern char *GetIdentifier();
|
||||
|
||||
UnknownIdIsZero = 0;
|
||||
nam = GetIdentifier();
|
||||
@@ -137,9 +139,7 @@ replace(idef)
|
||||
|
||||
char FilNamBuf[PATHLENGTH];
|
||||
|
||||
PRIVATE
|
||||
macro_func(idef)
|
||||
register struct idf *idef;
|
||||
static void macro_func(struct idf *idef)
|
||||
{
|
||||
/* macro_func() performs the special actions needed with some
|
||||
macros. These macros are __FILE__ and __LINE__ which
|
||||
@@ -167,11 +167,7 @@ macro_func(idef)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE char *
|
||||
macro2buffer(idef, actpars, siztext)
|
||||
struct idf *idef;
|
||||
char **actpars;
|
||||
int *siztext;
|
||||
static char *macro2buffer(struct idf *idef, char **actpars, int *siztext)
|
||||
{
|
||||
/* Macro2buffer() turns the macro replacement text, as it is
|
||||
stored, into an input buffer, while each occurrence of the
|
||||
@@ -214,14 +210,12 @@ macro2buffer(idef, actpars, siztext)
|
||||
return Realloc(text, pos+1);
|
||||
}
|
||||
|
||||
EXPORT
|
||||
DoUnstack()
|
||||
void DoUnstack()
|
||||
{
|
||||
Unstacked = 1;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
EnableMacros()
|
||||
void EnableMacros()
|
||||
{
|
||||
register struct mlist *p = ReplList, *prev = 0;
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
#define EOS '\0'
|
||||
#define overflow() (fatal("actual parameter buffer overflow"))
|
||||
|
||||
PRIVATE char apbuf[LAPBUF]; /* temporary storage for actual parameters */
|
||||
PRIVATE char *actparams[NPARAMS]; /* pointers to the text of the actuals */
|
||||
PRIVATE char *aptr; /* pointer to last inserted character in apbuf */
|
||||
static char apbuf[LAPBUF]; /* temporary storage for actual parameters */
|
||||
static char *actparams[NPARAMS]; /* pointers to the text of the actuals */
|
||||
static char *aptr; /* pointer to last inserted character in apbuf */
|
||||
|
||||
#define copy(ch) ((aptr < &apbuf[LAPBUF]) ? (*aptr++ = ch) : overflow())
|
||||
|
||||
PRIVATE int nr_of_params; /* number of actuals read until now */
|
||||
static int nr_of_params; /* number of actuals read until now */
|
||||
|
||||
PRIVATE char **
|
||||
getactuals(idef)
|
||||
struct idf *idef;
|
||||
static void copyact(char ch1, char ch2, int level);
|
||||
|
||||
char **getactuals(struct idf *idef)
|
||||
{
|
||||
/* getactuals() collects the actual parameters and turns them
|
||||
into a list of strings, a pointer to which is returned.
|
||||
@@ -76,10 +76,7 @@ getactuals(idef)
|
||||
return actparams;
|
||||
}
|
||||
|
||||
PRIVATE
|
||||
copyact(ch1, ch2, level)
|
||||
char ch1, ch2;
|
||||
int level;
|
||||
static void copyact(char ch1, char ch2, int level)
|
||||
{
|
||||
/* copyact() is taken from Ceriel Jacobs' LLgen, with
|
||||
permission. Its task is to build a list of actuals
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#include "class.h"
|
||||
#include "input.h"
|
||||
|
||||
int
|
||||
skipspaces(ch, skipnl)
|
||||
register int ch;
|
||||
int skipspaces(int ch, int skipnl)
|
||||
{
|
||||
/* skipspaces() skips any white space and returns the first
|
||||
non-space character.
|
||||
@@ -52,18 +50,18 @@ skipspaces(ch, skipnl)
|
||||
}
|
||||
}
|
||||
|
||||
skipline()
|
||||
void skipline()
|
||||
{
|
||||
/* skipline() skips all characters until a newline character
|
||||
is seen, not escaped by a '\\'.
|
||||
Any comment is skipped.
|
||||
*/
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
LoadChar(c);
|
||||
while (class(c) != STNL && c != EOI) {
|
||||
if (class(c) == STSTR || class(c) == STCHAR) {
|
||||
register int stopc = c;
|
||||
int stopc = c;
|
||||
int escaped;
|
||||
do {
|
||||
escaped = 0;
|
||||
|
||||
Reference in New Issue
Block a user