Kaydet (Commit) 0a0c70e0 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Caolán McNamara

mkdepend: cleanup indentation and function declarations

to make it easier to read

Change-Id: Iff0fe055c12358edc1be335ec83d0855cc32f03c
Reviewed-on: https://gerrit.libreoffice.org/9877Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 290b7e06
...@@ -187,20 +187,17 @@ _my_eval_variable (IfParser *ip, const char *var, int len) ...@@ -187,20 +187,17 @@ _my_eval_variable (IfParser *ip, const char *var, int len)
if (!s) if (!s)
return 0; return 0;
do { do {
var = s; var = s;
if (!isvarfirstletter(*var)) if (!isvarfirstletter(*var))
break; break;
s = _lookup_variable (var, strlen(var)); s = _lookup_variable (var, strlen(var));
} while (s); } while (s);
return atoi(var); return atoi(var);
} }
int cppsetup(line, filep, inc) int cppsetup(char *line, struct filepointer *filep, struct inclist *inc)
char *line;
struct filepointer *filep;
struct inclist *inc;
{ {
IfParser ip; IfParser ip;
struct _parse_data pd; struct _parse_data pd;
...@@ -216,9 +213,9 @@ int cppsetup(line, filep, inc) ...@@ -216,9 +213,9 @@ int cppsetup(line, filep, inc)
(void) ParseIfExpression (&ip, line, &val); (void) ParseIfExpression (&ip, line, &val);
if (val) if (val)
return IF; return IF;
else else
return IFFALSE; return IFFALSE;
} }
#endif /* CPP */ #endif /* CPP */
......
...@@ -125,15 +125,15 @@ struct symhash { ...@@ -125,15 +125,15 @@ struct symhash {
}; };
struct inclist { struct inclist {
char *i_incstring; /* string from #include line */ char *i_incstring; /* string from #include line */
char *i_file; /* path name of the include file */ char *i_file; /* path name of the include file */
struct inclist **i_list; /* list of files it itself includes */ struct inclist **i_list; /* list of files it itself includes */
int i_listlen; /* length of i_list */ int i_listlen; /* length of i_list */
boolean i_defchecked; /* whether defines have been checked */ boolean i_defchecked; /* whether defines have been checked */
boolean i_notified; /* whether we have revealed includes */ boolean i_notified; /* whether we have revealed includes */
boolean i_marked; /* whether it's in the makefile */ boolean i_marked; /* whether it's in the makefile */
boolean i_searched; /* whether we have read this */ boolean i_searched; /* whether we have read this */
boolean i_included_sym; /* whether #include SYMBOL was found */ boolean i_included_sym; /* whether #include SYMBOL was found */
/* Can't use i_list if TRUE */ /* Can't use i_list if TRUE */
}; };
......
...@@ -123,66 +123,66 @@ parse_value (IfParser *g, const char *cp, int *valp) ...@@ -123,66 +123,66 @@ parse_value (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '(': case '(':
DO (cp = ParseIfExpression (g, cp + 1, valp)); DO (cp = ParseIfExpression (g, cp + 1, valp));
SKIPSPACE (cp); SKIPSPACE (cp);
if (*cp != ')') if (*cp != ')')
return CALLFUNC(g, handle_error) (g, cp, ")"); return CALLFUNC(g, handle_error) (g, cp, ")");
return cp + 1; /* skip the right paren */ return cp + 1; /* skip the right paren */
case '!': case '!':
DO (cp = parse_value (g, cp + 1, valp)); DO (cp = parse_value (g, cp + 1, valp));
*valp = !(*valp); *valp = !(*valp);
return cp; return cp;
case '-': case '-':
DO (cp = parse_value (g, cp + 1, valp)); DO (cp = parse_value (g, cp + 1, valp));
*valp = -(*valp); *valp = -(*valp);
return cp; return cp;
case '#': case '#':
DO (cp = parse_variable (g, cp + 1, &var));
SKIPSPACE (cp);
if (*cp != '(')
return CALLFUNC(g, handle_error) (g, cp, "(");
do {
DO (cp = parse_variable (g, cp + 1, &var)); DO (cp = parse_variable (g, cp + 1, &var));
SKIPSPACE (cp); SKIPSPACE (cp);
} while (*cp && *cp != ')'); if (*cp != '(')
if (*cp != ')') return CALLFUNC(g, handle_error) (g, cp, "(");
return CALLFUNC(g, handle_error) (g, cp, ")"); do {
*valp = 1; /* XXX */ DO (cp = parse_variable (g, cp + 1, &var));
return cp + 1; SKIPSPACE (cp);
} while (*cp && *cp != ')');
if (*cp != ')')
return CALLFUNC(g, handle_error) (g, cp, ")");
*valp = 1; /* XXX */
return cp + 1;
case 'd': case 'd':
if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) { if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) {
int paren = 0; int paren = 0;
int len; int len;
cp += 7; cp += 7;
SKIPSPACE (cp); SKIPSPACE (cp);
if (*cp == '(') { if (*cp == '(') {
paren = 1; paren = 1;
cp++; cp++;
}
DO (cp = parse_variable (g, cp, &var));
len = (int)(cp - var);
SKIPSPACE (cp);
if (paren && *cp != ')')
return CALLFUNC(g, handle_error) (g, cp, ")");
*valp = (*(g->funcs.eval_defined)) (g, var, len);
return cp + paren; /* skip the right paren */
} }
DO (cp = parse_variable (g, cp, &var));
len = (int)(cp - var);
SKIPSPACE (cp);
if (paren && *cp != ')')
return CALLFUNC(g, handle_error) (g, cp, ")");
*valp = (*(g->funcs.eval_defined)) (g, var, len);
return cp + paren; /* skip the right paren */
}
/* fall out */ /* fall out */
} }
if (isdigit(*cp)) { if (isdigit(*cp)) {
DO (cp = parse_number (g, cp, valp)); DO (cp = parse_number (g, cp, valp));
} else if (!isvarfirstletter(*cp)) } else if (!isvarfirstletter(*cp))
return CALLFUNC(g, handle_error) (g, cp, "variable or number"); return CALLFUNC(g, handle_error) (g, cp, "variable or number");
else { else {
DO (cp = parse_variable (g, cp, &var)); DO (cp = parse_variable (g, cp, &var));
*valp = (*(g->funcs.eval_variable)) (g, var, cp - var); *valp = (*(g->funcs.eval_variable)) (g, var, cp - var);
} }
return cp; return cp;
...@@ -200,23 +200,23 @@ parse_product (IfParser *g, const char *cp, int *valp) ...@@ -200,23 +200,23 @@ parse_product (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '*': case '*':
DO (cp = parse_product (g, cp + 1, &rightval)); DO (cp = parse_product (g, cp + 1, &rightval));
*valp = (*valp * rightval); *valp = (*valp * rightval);
break; break;
case '/': case '/':
DO (cp = parse_product (g, cp + 1, &rightval)); DO (cp = parse_product (g, cp + 1, &rightval));
/* Do nothing in the divide-by-zero case. */ /* Do nothing in the divide-by-zero case. */
if (rightval) { if (rightval) {
*valp = (*valp / rightval); *valp = (*valp / rightval);
} }
break; break;
case '%': case '%':
DO (cp = parse_product (g, cp + 1, &rightval)); DO (cp = parse_product (g, cp + 1, &rightval));
*valp = (*valp % rightval); *valp = (*valp % rightval);
break; break;
} }
return cp; return cp;
} }
...@@ -232,14 +232,14 @@ parse_sum (IfParser *g, const char *cp, int *valp) ...@@ -232,14 +232,14 @@ parse_sum (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '+': case '+':
DO (cp = parse_sum (g, cp + 1, &rightval)); DO (cp = parse_sum (g, cp + 1, &rightval));
*valp = (*valp + rightval); *valp = (*valp + rightval);
break; break;
case '-': case '-':
DO (cp = parse_sum (g, cp + 1, &rightval)); DO (cp = parse_sum (g, cp + 1, &rightval));
*valp = (*valp - rightval); *valp = (*valp - rightval);
break; break;
} }
return cp; return cp;
} }
...@@ -255,18 +255,18 @@ parse_shift (IfParser *g, const char *cp, int *valp) ...@@ -255,18 +255,18 @@ parse_shift (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '<': case '<':
if (cp[1] == '<') { if (cp[1] == '<') {
DO (cp = parse_shift (g, cp + 2, &rightval)); DO (cp = parse_shift (g, cp + 2, &rightval));
*valp = (*valp << rightval); *valp = (*valp << rightval);
} }
break; break;
case '>': case '>':
if (cp[1] == '>') { if (cp[1] == '>') {
DO (cp = parse_shift (g, cp + 2, &rightval)); DO (cp = parse_shift (g, cp + 2, &rightval));
*valp = (*valp >> rightval); *valp = (*valp >> rightval);
} }
break; break;
} }
return cp; return cp;
} }
...@@ -282,24 +282,24 @@ parse_inequality (IfParser *g, const char *cp, int *valp) ...@@ -282,24 +282,24 @@ parse_inequality (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '<': case '<':
if (cp[1] == '=') { if (cp[1] == '=') {
DO (cp = parse_inequality (g, cp + 2, &rightval)); DO (cp = parse_inequality (g, cp + 2, &rightval));
*valp = (*valp <= rightval); *valp = (*valp <= rightval);
} else { } else {
DO (cp = parse_inequality (g, cp + 1, &rightval)); DO (cp = parse_inequality (g, cp + 1, &rightval));
*valp = (*valp < rightval); *valp = (*valp < rightval);
} }
break; break;
case '>': case '>':
if (cp[1] == '=') { if (cp[1] == '=') {
DO (cp = parse_inequality (g, cp + 2, &rightval)); DO (cp = parse_inequality (g, cp + 2, &rightval));
*valp = (*valp >= rightval); *valp = (*valp >= rightval);
} else { } else {
DO (cp = parse_inequality (g, cp + 1, &rightval)); DO (cp = parse_inequality (g, cp + 1, &rightval));
*valp = (*valp > rightval); *valp = (*valp > rightval);
} }
break; break;
} }
return cp; return cp;
} }
...@@ -315,18 +315,18 @@ parse_equality (IfParser *g, const char *cp, int *valp) ...@@ -315,18 +315,18 @@ parse_equality (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '=': case '=':
if (cp[1] == '=') if (cp[1] == '=')
cp++; cp++;
DO (cp = parse_equality (g, cp + 1, &rightval)); DO (cp = parse_equality (g, cp + 1, &rightval));
*valp = (*valp == rightval); *valp = (*valp == rightval);
break; break;
case '!': case '!':
if (cp[1] != '=') if (cp[1] != '=')
break;
DO (cp = parse_equality (g, cp + 2, &rightval));
*valp = (*valp != rightval);
break; break;
DO (cp = parse_equality (g, cp + 2, &rightval));
*valp = (*valp != rightval);
break;
} }
return cp; return cp;
} }
...@@ -342,11 +342,11 @@ parse_band (IfParser *g, const char *cp, int *valp) ...@@ -342,11 +342,11 @@ parse_band (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '&': case '&':
if (cp[1] != '&') { if (cp[1] != '&') {
DO (cp = parse_band (g, cp + 1, &rightval)); DO (cp = parse_band (g, cp + 1, &rightval));
*valp = (*valp & rightval); *valp = (*valp & rightval);
} }
break; break;
} }
return cp; return cp;
} }
...@@ -362,11 +362,11 @@ parse_bor (IfParser *g, const char *cp, int *valp) ...@@ -362,11 +362,11 @@ parse_bor (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '|': case '|':
if (cp[1] != '|') { if (cp[1] != '|') {
DO (cp = parse_bor (g, cp + 1, &rightval)); DO (cp = parse_bor (g, cp + 1, &rightval));
*valp = (*valp | rightval); *valp = (*valp | rightval);
} }
break; break;
} }
return cp; return cp;
} }
...@@ -382,11 +382,11 @@ parse_land (IfParser *g, const char *cp, int *valp) ...@@ -382,11 +382,11 @@ parse_land (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '&': case '&':
if (cp[1] != '&') if (cp[1] != '&')
return CALLFUNC(g, handle_error) (g, cp, "&&"); return CALLFUNC(g, handle_error) (g, cp, "&&");
DO (cp = parse_land (g, cp + 2, &rightval)); DO (cp = parse_land (g, cp + 2, &rightval));
*valp = (*valp && rightval); *valp = (*valp && rightval);
break; break;
} }
return cp; return cp;
} }
...@@ -402,11 +402,11 @@ parse_lor (IfParser *g, const char *cp, int *valp) ...@@ -402,11 +402,11 @@ parse_lor (IfParser *g, const char *cp, int *valp)
switch (*cp) { switch (*cp) {
case '|': case '|':
if (cp[1] != '|') if (cp[1] != '|')
return CALLFUNC(g, handle_error) (g, cp, "||"); return CALLFUNC(g, handle_error) (g, cp, "||");
DO (cp = parse_lor (g, cp + 2, &rightval)); DO (cp = parse_lor (g, cp + 2, &rightval));
*valp = (*valp || rightval); *valp = (*valp || rightval);
break; break;
} }
return cp; return cp;
} }
...@@ -417,10 +417,7 @@ parse_lor (IfParser *g, const char *cp, int *valp) ...@@ -417,10 +417,7 @@ parse_lor (IfParser *g, const char *cp, int *valp)
****************************************************************************/ ****************************************************************************/
const char * const char *
ParseIfExpression (g, cp, valp) ParseIfExpression (IfParser *g, const char *cp, int *valp)
IfParser *g;
const char *cp;
int *valp;
{ {
return parse_lor (g, cp, valp); return parse_lor (g, cp, valp);
} }
......
...@@ -64,10 +64,9 @@ typedef int Bool; ...@@ -64,10 +64,9 @@ typedef int Bool;
typedef struct _if_parser { typedef struct _if_parser {
struct { /* functions */ struct { /* functions */
const char *(*handle_error) (struct _if_parser *, const char *, const char *(*handle_error) (struct _if_parser *, const char *, const char *);
const char *); int (*eval_variable) (struct _if_parser *, const char *, int);
int (*eval_variable) (struct _if_parser *, const char *, int); int (*eval_defined) (struct _if_parser *, const char *, int);
int (*eval_defined) (struct _if_parser *, const char *, int);
} funcs; } funcs;
char *data; char *data;
} IfParser; } IfParser;
......
...@@ -38,14 +38,14 @@ int issymbolic(char * dir, char * component); ...@@ -38,14 +38,14 @@ int issymbolic(char * dir, char * component);
int exists_path(struct IncludesCollection*, char*); int exists_path(struct IncludesCollection*, char*);
extern struct inclist inclist[ MAXFILES ], extern struct inclist inclist[ MAXFILES ],
*inclistp; *inclistp;
extern char *includedirs[ ]; extern char *includedirs[ ];
extern char *notdotdot[ ]; extern char *notdotdot[ ];
extern boolean show_where_not; extern boolean show_where_not;
extern boolean warn_multiple; extern boolean warn_multiple;
struct inclist *inc_path(char *file, char *include, boolean dot, struct IncludesCollection* incCollection) struct inclist *inc_path(char *file, char *include, boolean dot, struct IncludesCollection *incCollection)
{ {
static char path[ BUFSIZ ]; static char path[ BUFSIZ ];
char **pp, *p; char **pp, *p;
...@@ -61,8 +61,8 @@ struct inclist *inc_path(char *file, char *include, boolean dot, struct Includes ...@@ -61,8 +61,8 @@ struct inclist *inc_path(char *file, char *include, boolean dot, struct Includes
for (ip = inclist; ip->i_file; ip++) for (ip = inclist; ip->i_file; ip++)
if ((strcmp(ip->i_incstring, include) == 0) && !ip->i_included_sym) if ((strcmp(ip->i_incstring, include) == 0) && !ip->i_included_sym)
{ {
found = TRUE; found = TRUE;
break; break;
} }
/* /*
...@@ -128,9 +128,7 @@ struct inclist *inc_path(char *file, char *include, boolean dot, struct Includes ...@@ -128,9 +128,7 @@ struct inclist *inc_path(char *file, char *include, boolean dot, struct Includes
return(ip); return(ip);
} }
int exists_path(incCollection, path) int exists_path(struct IncludesCollection *incCollection, char *path)
struct IncludesCollection* incCollection;
char* path;
{ {
convert_slashes(path); convert_slashes(path);
return call_IncludesCollection_exists(incCollection, path); return call_IncludesCollection_exists(incCollection, path);
...@@ -141,8 +139,7 @@ int exists_path(incCollection, path) ...@@ -141,8 +139,7 @@ int exists_path(incCollection, path)
* Any of the 'x/..' sequences within the name can be eliminated. * Any of the 'x/..' sequences within the name can be eliminated.
* (but only if 'x' is not a symbolic link!!) * (but only if 'x' is not a symbolic link!!)
*/ */
void remove_dotdot(path) void remove_dotdot(char *path)
char *path;
{ {
char *end, *from, *to, **cp; char *end, *from, *to, **cp;
char *components[ MAXFILES ], char *components[ MAXFILES ],
...@@ -179,9 +176,9 @@ void remove_dotdot(path) ...@@ -179,9 +176,9 @@ void remove_dotdot(path)
char **fp = cp + 2; char **fp = cp + 2;
char **tp = cp; char **tp = cp;
do do {
*tp++ = *fp; /* move all the pointers down */ *tp++ = *fp; /* move all the pointers down */
while (*fp++); } while (*fp++);
if (cp != components) if (cp != components)
cp--; /* go back and check for nested ".." */ cp--; /* go back and check for nested ".." */
} else { } else {
...@@ -210,24 +207,21 @@ void remove_dotdot(path) ...@@ -210,24 +207,21 @@ void remove_dotdot(path)
strcpy(path, newpath); strcpy(path, newpath);
} }
int isdot(p) int isdot(char *p)
char *p;
{ {
if(p && p[0] == '.' && p[1] == '\0') if(p && p[0] == '.' && p[1] == '\0')
return(TRUE); return(TRUE);
return(FALSE); return(FALSE);
} }
int isdotdot(p) int isdotdot(char *p)
char *p;
{ {
if(p && p[0] == '.' && p[1] == '.' && p[2] == '\0') if(p && p[0] == '.' && p[1] == '.' && p[2] == '\0')
return(TRUE); return(TRUE);
return(FALSE); return(FALSE);
} }
int issymbolic(dir, component) int issymbolic(char *dir, char *component)
char *dir, *component;
{ {
#ifdef S_IFLNK #ifdef S_IFLNK
struct stat st; struct stat st;
...@@ -251,8 +245,7 @@ int issymbolic(dir, component) ...@@ -251,8 +245,7 @@ int issymbolic(dir, component)
/* /*
* Add an include file to the list of those included by 'file'. * Add an include file to the list of those included by 'file'.
*/ */
struct inclist *newinclude(newfile, incstring) struct inclist *newinclude(char *newfile, char *incstring)
char *newfile, *incstring;
{ {
struct inclist *ip; struct inclist *ip;
...@@ -272,8 +265,7 @@ struct inclist *newinclude(newfile, incstring) ...@@ -272,8 +265,7 @@ struct inclist *newinclude(newfile, incstring)
return(ip); return(ip);
} }
void included_by(ip, newfile) void included_by(struct inclist *ip, struct inclist *newfile)
struct inclist *ip, *newfile;
{ {
int i; int i;
......
...@@ -118,7 +118,7 @@ char *directives[] = { ...@@ -118,7 +118,7 @@ char *directives[] = {
void redirect(char * line, char * makefile ); void redirect(char * line, char * makefile );
struct inclist inclist[ MAXFILES ], struct inclist inclist[ MAXFILES ],
*inclistp = inclist; *inclistp = inclist;
struct symhash *maininclist = NULL; struct symhash *maininclist = NULL;
...@@ -472,8 +472,7 @@ int main(int argc, char **argv) ...@@ -472,8 +472,7 @@ int main(int argc, char **argv)
exit(0); exit(0);
} }
struct filepointer *getfile(file) struct filepointer *getfile(char *file)
char *file;
{ {
int fd; int fd;
struct filepointer *content; struct filepointer *content;
...@@ -521,15 +520,13 @@ struct filepointer *getfile(file) ...@@ -521,15 +520,13 @@ struct filepointer *getfile(file)
return(content); return(content);
} }
void freefile(fp) void freefile(struct filepointer *fp)
struct filepointer *fp;
{ {
free(fp->f_base); free(fp->f_base);
free(fp); free(fp);
} }
char *copy(str) char *copy(char *str)
char *str;
{ {
char *p = (char *)malloc(strlen(str) + 1); char *p = (char *)malloc(strlen(str) + 1);
...@@ -537,8 +534,7 @@ char *copy(str) ...@@ -537,8 +534,7 @@ char *copy(str)
return(p); return(p);
} }
int match(str, list) int match(char *str, char **list)
char *str, **list;
{ {
int i; int i;
...@@ -552,8 +548,7 @@ int match(str, list) ...@@ -552,8 +548,7 @@ int match(str, list)
* Get the next line. We only return lines beginning with '#' since that * Get the next line. We only return lines beginning with '#' since that
* is all this program is ever interested in. * is all this program is ever interested in.
*/ */
char *get_line(filep) char *get_line(struct filepointer *filep)
struct filepointer *filep;
{ {
char *p, /* walking pointer */ char *p, /* walking pointer */
*eof, /* end of file pointer */ *eof, /* end of file pointer */
...@@ -622,8 +617,7 @@ done: ...@@ -622,8 +617,7 @@ done:
* Strip the file name down to what we want to see in the Makefile. * Strip the file name down to what we want to see in the Makefile.
* It will have objprefix and objsuffix around it. * It will have objprefix and objsuffix around it.
*/ */
char *base_name(file) char *base_name(char *file)
char *file;
{ {
char *p; char *p;
...@@ -644,8 +638,7 @@ char *base_name(file) ...@@ -644,8 +638,7 @@ char *base_name(file)
} }
#if defined(USG) && !defined(CRAY) && !defined(SVR4) #if defined(USG) && !defined(CRAY) && !defined(SVR4)
int rename (from, to) int rename (char *from, char *to)
char *from, *to;
{ {
(void) unlink (to); (void) unlink (to);
if (link (from, to) == 0) { if (link (from, to) == 0) {
...@@ -657,9 +650,7 @@ int rename (from, to) ...@@ -657,9 +650,7 @@ int rename (from, to)
} }
#endif /* USGISH */ #endif /* USGISH */
void redirect(line, makefile) void redirect(char *line, char *makefile)
char *line,
*makefile;
{ {
FILE *fdout; FILE *fdout;
fdout = freopen(makefile, "wb", stdout); // binary mode please fdout = freopen(makefile, "wb", stdout); // binary mode please
...@@ -771,8 +762,7 @@ void warning1(char *msg, ...) ...@@ -771,8 +762,7 @@ void warning1(char *msg, ...)
#endif /* DEBUG_MKDEPEND */ #endif /* DEBUG_MKDEPEND */
} }
void convert_slashes(path) void convert_slashes(char *path)
char* path;
{ {
#if defined (WNT) #if defined (WNT)
/* /*
...@@ -793,8 +783,7 @@ void convert_slashes(path) ...@@ -793,8 +783,7 @@ void convert_slashes(path)
#endif #endif
} }
char* append_slash(path) char* append_slash(char *path)
char* path;
{ {
char *new_string; char *new_string;
if ((path[strlen(path) - 1] == '/') || (path[strlen(path) - 1] == '\\')) { if ((path[strlen(path) - 1] == '/') || (path[strlen(path) - 1] == '\\')) {
......
...@@ -162,10 +162,10 @@ int find_includes(struct filepointer *filep, struct inclist *file, struct inclis ...@@ -162,10 +162,10 @@ int find_includes(struct filepointer *filep, struct inclist *file, struct inclis
return(-1); return(-1);
} }
int gobble(filep, file, file_red, symbols) int gobble(struct filepointer *filep,
struct filepointer *filep; struct inclist *file,
struct inclist *file, *file_red; struct inclist *file_red,
struct symhash *symbols; struct symhash *symbols)
{ {
char *line; char *line;
int type; int type;
...@@ -216,12 +216,7 @@ int gobble(filep, file, file_red, symbols) ...@@ -216,12 +216,7 @@ int gobble(filep, file, file_red, symbols)
/* /*
* Decide what type of # directive this line is. * Decide what type of # directive this line is.
*/ */
int deftype (line, filep, file_red, file, parse_it, symbols) int deftype (char *line, struct filepointer *filep, struct inclist *file_red, struct inclist *file, int parse_it, struct symhash *symbols)
char *line;
struct filepointer *filep;
struct inclist *file_red, *file;
int parse_it;
struct symhash *symbols;
{ {
char *p; char *p;
char *directive, savechar; char *directive, savechar;
...@@ -251,7 +246,7 @@ int deftype (line, filep, file_red, file, parse_it, symbols) ...@@ -251,7 +246,7 @@ int deftype (line, filep, file_red, file, parse_it, symbols)
if (ret == ELIF && !parse_it) if (ret == ELIF && !parse_it)
{ {
while (*p == ' ' || *p == '\t') while (*p == ' ' || *p == '\t')
p++; p++;
/* /*
* parse an expression. * parse an expression.
*/ */
...@@ -260,16 +255,16 @@ int deftype (line, filep, file_red, file, parse_it, symbols) ...@@ -260,16 +255,16 @@ int deftype (line, filep, file_red, file, parse_it, symbols)
ret = zero_value(p, filep, file_red, symbols); ret = zero_value(p, filep, file_red, symbols);
if (ret != IF) if (ret != IF)
{ {
debug(0,("false...\n")); debug(0,("false...\n"));
if (ret == IFFALSE) if (ret == IFFALSE)
return(ELIFFALSE); return(ELIFFALSE);
else else
return(ELIFGUESSFALSE); return(ELIFGUESSFALSE);
} }
else else
{ {
debug(0,("true...\n")); debug(0,("true...\n"));
return(ELIF); return(ELIF);
} }
} }
...@@ -368,8 +363,7 @@ int deftype (line, filep, file_red, file, parse_it, symbols) ...@@ -368,8 +363,7 @@ int deftype (line, filep, file_red, file, parse_it, symbols)
*/ */
struct symhash *global_symbols = NULL; struct symhash *global_symbols = NULL;
char * isdefined( symbol ) char * isdefined( char *symbol )
char *symbol;
{ {
return hash_lookup( symbol, global_symbols ); return hash_lookup( symbol, global_symbols );
} }
...@@ -377,11 +371,7 @@ char * isdefined( symbol ) ...@@ -377,11 +371,7 @@ char * isdefined( symbol )
/* /*
* Return type based on if the #if expression evaluates to 0 * Return type based on if the #if expression evaluates to 0
*/ */
int zero_value(exp, filep, file_red, symbols) int zero_value(char *exp, struct filepointer *filep, struct inclist *file_red, struct symhash *symbols)
char *exp;
struct filepointer *filep;
struct inclist *file_red;
struct symhash *symbols;
{ {
global_symbols = symbols; /* HACK! see above */ global_symbols = symbols; /* HACK! see above */
if (cppsetup(exp, filep, file_red)) if (cppsetup(exp, filep, file_red))
...@@ -390,9 +380,7 @@ int zero_value(exp, filep, file_red, symbols) ...@@ -390,9 +380,7 @@ int zero_value(exp, filep, file_red, symbols)
return(IF); return(IF);
} }
void define( def, symbols ) void define( char *def, struct symhash **symbols )
char *def;
struct symhash **symbols;
{ {
char *val; char *val;
...@@ -423,8 +411,7 @@ static int hash( char *str ) ...@@ -423,8 +411,7 @@ static int hash( char *str )
return hashval & ( SYMHASHMEMBERS - 1 ); return hashval & ( SYMHASHMEMBERS - 1 );
} }
struct symhash *hash_copy( symbols ) struct symhash *hash_copy( struct symhash *symbols )
struct symhash *symbols;
{ {
int i; int i;
struct symhash *newsym; struct symhash *newsym;
...@@ -459,8 +446,7 @@ struct symhash *hash_copy( symbols ) ...@@ -459,8 +446,7 @@ struct symhash *hash_copy( symbols )
return newsym; return newsym;
} }
void hash_free( symbols ) void hash_free( struct symhash *symbols )
struct symhash *symbols;
{ {
int i; int i;
...@@ -481,9 +467,7 @@ void hash_free( symbols ) ...@@ -481,9 +467,7 @@ void hash_free( symbols )
free( symbols->s_pairs ); free( symbols->s_pairs );
} }
void hash_define( name, val, symbols ) void hash_define( char *name, char *val, struct symhash **symbols )
char *name, *val;
struct symhash **symbols;
{ {
int hashval; int hashval;
struct pair *it; struct pair *it;
...@@ -537,9 +521,7 @@ void hash_define( name, val, symbols ) ...@@ -537,9 +521,7 @@ void hash_define( name, val, symbols )
} }
} }
char *hash_lookup( symbol, symbols ) char *hash_lookup( char *symbol, struct symhash *symbols )
char *symbol;
struct symhash *symbols;
{ {
struct pair *it; struct pair *it;
...@@ -558,9 +540,7 @@ char *hash_lookup( symbol, symbols ) ...@@ -558,9 +540,7 @@ char *hash_lookup( symbol, symbols )
return NULL; return NULL;
} }
void hash_undefine( symbol, symbols ) void hash_undefine( char *symbol, struct symhash *symbols )
char *symbol;
struct symhash *symbols;
{ {
int hashval; int hashval;
struct pair *it; struct pair *it;
......
...@@ -32,7 +32,7 @@ in this Software without prior written authorization from the X Consortium. ...@@ -32,7 +32,7 @@ in this Software without prior written authorization from the X Consortium.
size_t pr( struct inclist *ip, char *file,char *base); size_t pr( struct inclist *ip, char *file,char *base);
extern struct inclist inclist[ MAXFILES ], extern struct inclist inclist[ MAXFILES ],
*inclistp; *inclistp;
extern char *objprefix; extern char *objprefix;
extern char *objsuffix; extern char *objsuffix;
extern int width; extern int width;
...@@ -85,9 +85,7 @@ void pr_dummy(struct inclist *ip) ...@@ -85,9 +85,7 @@ void pr_dummy(struct inclist *ip)
fwrite(" :\n\n", 4, 1, stdout); fwrite(" :\n\n", 4, 1, stdout);
} }
void recursive_pr_dummy(head, file) void recursive_pr_dummy(struct inclist *head, char *file)
struct inclist *head;
char *file;
{ {
int i; int i;
...@@ -101,9 +99,7 @@ void recursive_pr_dummy(head, file) ...@@ -101,9 +99,7 @@ void recursive_pr_dummy(head, file)
} }
void recursive_pr_include(head, file, base) void recursive_pr_include(struct inclist *head, char *file, char *base)
struct inclist *head;
char *file, *base;
{ {
int i; int i;
...@@ -116,9 +112,7 @@ void recursive_pr_include(head, file, base) ...@@ -116,9 +112,7 @@ void recursive_pr_include(head, file, base)
recursive_pr_include(head->i_list[ i ], file, base); recursive_pr_include(head->i_list[ i ], file, base);
} }
size_t pr(ip, file, base) size_t pr(struct inclist *ip, char *file, char *base)
struct inclist *ip;
char *file, *base;
{ {
size_t ret; size_t ret;
static char *lastfile; static char *lastfile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment