More strict checks...
This commit is contained in:
committed by
Manoël Trapier
parent
a8d9183e25
commit
2bbd5a38de
@@ -3,10 +3,6 @@
|
||||
* This file is copied into Lpars.c.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char *rcsid = "$Id$";
|
||||
#endif
|
||||
|
||||
unsigned int LLtcnt[LL_NTERMINALS];
|
||||
unsigned int LLscnt[LL_NSETS];
|
||||
int LLcsymb, LLsymb;
|
||||
|
||||
@@ -68,7 +68,7 @@ typedef struct {
|
||||
#define p_cont(elem) ((path *)l_content(elem))
|
||||
|
||||
/* Return values of setpath() */
|
||||
enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
|
||||
enum f_path { FP_OK, FP_NOMATCH, FP_NOPATH } ;
|
||||
|
||||
/* Own routines */
|
||||
enum f_path getpath(trf **first);
|
||||
@@ -84,6 +84,66 @@ char *changecore(char *ptr, unsigned int size);
|
||||
#define freecore(area) free(area)
|
||||
growstring scanb(char *line);
|
||||
growstring scanvars(char *line);
|
||||
void throws(char *str);
|
||||
void start_scan();
|
||||
void scan_found();
|
||||
void find_cpp();
|
||||
void try(list_elem *f_scan, char *suffix);
|
||||
void setlist(char *name);
|
||||
void fuerror(const char *fmt, ...);
|
||||
void transini();
|
||||
int process(char *arg);
|
||||
void setsvar(char *name, char *str);
|
||||
void getmapflags(trf *phase);
|
||||
void vprint(const char* fmt, ...);
|
||||
void disc_inputs(trf *phase);
|
||||
int startrf(trf *first);
|
||||
void setpvar(char *name,char *(*rout)(void));
|
||||
void l_add(list_head *header, char *string);
|
||||
void error(const char *fmt, ...);
|
||||
void do_Rflag(char *argp);
|
||||
void werror(const char *fmt, ...);
|
||||
void add_input(path *file, trf *phase);
|
||||
void add_head(char *str);
|
||||
void add_tail(char *str);
|
||||
int mayprep();
|
||||
int transform(trf *phase);
|
||||
void fatal(const char* fmt, ...);
|
||||
void l_clear(list_head *header);
|
||||
int satisfy(trf *trafo, char *suffix);
|
||||
int setfiles(trf *phase);
|
||||
void disc_files(trf *phase);
|
||||
int runphase(trf *phase);
|
||||
void rmfile(path *file);
|
||||
int mapflag(list_head *maplist, char *cflag);
|
||||
void clr_noscan(char *str);
|
||||
void l_throw(list_head *header);
|
||||
int mapexpand(char *mapentry, char *cflag);
|
||||
void prns(char *s);
|
||||
void set_Rflag(char *argp);
|
||||
void condit(growstring *line, list_head *fsuff, list_head *lsuff, char *tailval);
|
||||
void doassign(char *line, char *star, int length);
|
||||
void getcallargs(trf *phase);
|
||||
void discardargs(trf *phase);
|
||||
void quit(int code);
|
||||
void rmtemps();
|
||||
void intrf();
|
||||
void open_in(char *name);
|
||||
void close_in();
|
||||
int getinchar();
|
||||
int getln();
|
||||
void keephead(char *suffix);
|
||||
void varinit();
|
||||
void vieuwargs(int argc, char *argv[]);
|
||||
void firstarg(char *argp);
|
||||
void block(trf *first);
|
||||
void keeptail(char *suffix);
|
||||
void scanneeds();
|
||||
void setneeds(char *suffix, int tail);
|
||||
int run_exec(trf *phase, char *prog);
|
||||
void do_flush();
|
||||
void file_final(path *file);
|
||||
|
||||
|
||||
#define DEBUG 1 /* Allow debugging of Ack */
|
||||
|
||||
|
||||
@@ -6,15 +6,8 @@
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#define EXTERN
|
||||
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_data[] = RCS_DATA ;
|
||||
#endif
|
||||
|
||||
@@ -14,12 +14,7 @@
|
||||
#include "data.h"
|
||||
#include <em_path.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
void file_final(path *file);
|
||||
void disc_inputs(trf *phase);
|
||||
#include <unistd.h>
|
||||
|
||||
char *add_u(int part, char *ptr)
|
||||
{
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
#include "ack.h"
|
||||
#include "grows.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_grows[] = RCS_GROWS ;
|
||||
#endif
|
||||
|
||||
void gr_add(growstring *id, char c)
|
||||
{
|
||||
if ( id->gr_size==id->gr_max) {
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_list[] = RCS_LIST ;
|
||||
#endif
|
||||
|
||||
/* List handling, operations allowed:
|
||||
adding strings to the list,
|
||||
throwing away whole lists,
|
||||
|
||||
@@ -7,31 +7,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
#include <local.h>
|
||||
#include "data.h"
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_ack[] = RCS_ACK ;
|
||||
#endif
|
||||
|
||||
static int sigs[] = { SIGINT, SIGHUP, SIGTERM, 0 } ;
|
||||
static int arg_count;
|
||||
|
||||
void varinit();
|
||||
void vieuwargs(int argc, char *argv[]);
|
||||
void firstarg(char *argp);
|
||||
void block(trf *first);
|
||||
void keephead(char *suffix);
|
||||
void keeptail(char *suffix);
|
||||
void scanneeds();
|
||||
void setneeds(char *suffix, int tail);
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
register list_elem *elem ;
|
||||
@@ -297,15 +287,15 @@ int process(char *arg)
|
||||
p_basename= keeps(basename(arg)) ;
|
||||
/* Try to find a path through the transformations */
|
||||
switch( getpath(&phase) ) {
|
||||
case F_NOPATH :
|
||||
case FP_NOPATH :
|
||||
error("Cannot produce the desired file from %s",arg) ;
|
||||
if ( linker ) add_input(&orig,linker) ;
|
||||
return 1 ;
|
||||
case F_NOMATCH :
|
||||
case FP_NOMATCH :
|
||||
if ( stopsuffix ) werror("Unknown suffix in %s",arg) ;
|
||||
if ( linker ) add_input(&orig,linker) ;
|
||||
return 1 ;
|
||||
case F_OK :
|
||||
case FP_OK :
|
||||
break ;
|
||||
}
|
||||
if ( !phase ) return 1 ;
|
||||
@@ -457,7 +447,7 @@ void setneeds(char *suffix, int tail)
|
||||
|
||||
p_suffix= suffix ;
|
||||
switch ( getpath(&phase) ) {
|
||||
case F_OK :
|
||||
case FP_OK :
|
||||
for ( ; phase ; phase= phase->t_next ) {
|
||||
if ( phase->t_needed ) {
|
||||
if ( tail )
|
||||
@@ -467,10 +457,10 @@ void setneeds(char *suffix, int tail)
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case F_NOMATCH :
|
||||
case FP_NOMATCH :
|
||||
werror("\"%s\": unrecognized suffix",suffix) ;
|
||||
break ;
|
||||
case F_NOPATH :
|
||||
case FP_NOPATH :
|
||||
werror("sorry, cannot produce the desired file(s) from %s files",
|
||||
suffix) ;
|
||||
break ;
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||
|
||||
char *fname = 0 ;
|
||||
char dname[200] ;
|
||||
@@ -80,9 +78,9 @@ FILE *do_open(char *file)
|
||||
|
||||
void readm()
|
||||
{
|
||||
register int i ;
|
||||
register int token ;
|
||||
register FILE *in ;
|
||||
int i ;
|
||||
int token ;
|
||||
FILE *in ;
|
||||
|
||||
in=do_open(fname) ;
|
||||
if ( in==NULL ) {
|
||||
@@ -101,7 +99,7 @@ void readm()
|
||||
} else {
|
||||
fprintf(intab," ") ;
|
||||
}
|
||||
if ( !isascii(token) || !(isprint(token) || isspace(token)) ){
|
||||
if ( !IsAscii(token) || !(isprint(token) || isspace(token)) ){
|
||||
if ( token!=EOF ) {
|
||||
fprintf(stderr,"warning: non-ascii in %s\n",fname) ;
|
||||
fprintf(intab,"%4d,",token) ;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ack.h"
|
||||
@@ -15,11 +16,6 @@
|
||||
#include "data.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_dmach[] = RCS_DMACH ;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Read machine definitions and transformations */
|
||||
@@ -52,10 +48,6 @@ static char *ty_name ;
|
||||
static char *bol ;
|
||||
static char *inname ;
|
||||
|
||||
void intrf();
|
||||
void open_in(char *name);
|
||||
void close_in();
|
||||
|
||||
void setlist(char *name)
|
||||
{
|
||||
/* Name is sought in the internal tables,
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
#include "grows.h"
|
||||
#include "data.h"
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#define ARG_MORE 40 /* The size of args chunks to allocate */
|
||||
|
||||
|
||||
@@ -10,15 +10,6 @@
|
||||
#include "list.h"
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
void start_scan();
|
||||
void scan_found();
|
||||
void find_cpp();
|
||||
void try(list_elem *f_scan, char *suffix);
|
||||
|
||||
enum f_path getpath(trf **first)
|
||||
{
|
||||
/* Try to find a transformation path */
|
||||
@@ -225,7 +216,7 @@ enum f_path scan_end(trf **first)
|
||||
#ifdef DEBUG
|
||||
if ( debug>=3 ) vprint("End_scan\n");
|
||||
#endif
|
||||
if ( last_ncount== -1 ) return suf_found ? F_NOPATH : F_NOMATCH ;
|
||||
if ( last_ncount== -1 ) return suf_found ? FP_NOPATH : FP_NOMATCH ;
|
||||
#ifdef DEBUG
|
||||
if ( debug>=2 ) vprint("Transformation found\n");
|
||||
#endif
|
||||
@@ -240,7 +231,7 @@ enum f_path scan_end(trf **first)
|
||||
*first= curr ;
|
||||
}
|
||||
if ( curr->t_next ) {
|
||||
return F_OK ;
|
||||
return FP_OK ;
|
||||
}
|
||||
prev=curr ;
|
||||
}
|
||||
@@ -252,7 +243,7 @@ enum f_path scan_end(trf **first)
|
||||
if ( prev ) {
|
||||
prev->t_keep=YES ;
|
||||
}
|
||||
return F_OK ;
|
||||
return FP_OK ;
|
||||
}
|
||||
|
||||
void find_cpp()
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
#include <string.h>
|
||||
#include "ack.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
/* The processing of string valued variables,
|
||||
this is an almost self contained module.
|
||||
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
#include "grows.h"
|
||||
#include "data.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
static char rcs_trans[] = RCS_TRANS ;
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* Routines for transforming from one file type to another */
|
||||
/****************************************************************************/
|
||||
@@ -26,12 +21,6 @@ static int touch_head= NO ;
|
||||
static growstring tail ;
|
||||
static int touch_tail= NO ;
|
||||
|
||||
void set_Rflag(char *argp);
|
||||
void condit(growstring *line, list_head *fsuff, list_head *lsuff, char *tailval);
|
||||
void doassign(char *line, char *star, int length);
|
||||
void getcallargs(trf *phase);
|
||||
void discardargs(trf *phase);
|
||||
|
||||
int transform(trf *phase)
|
||||
{
|
||||
int ok ;
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
#include <ctype.h>
|
||||
#include "ack.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
#endif
|
||||
|
||||
extern char *progname ;
|
||||
extern int w_flag ;
|
||||
extern int n_error;
|
||||
@@ -32,10 +28,7 @@ extern int n_error;
|
||||
# define STDOUT stderr
|
||||
#endif
|
||||
|
||||
void fuerror(const char *fmt, ...);
|
||||
void werror(const char *fmt, ...);
|
||||
void quit(int code);
|
||||
|
||||
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||
|
||||
char *basename(char *string)
|
||||
{
|
||||
@@ -53,7 +46,7 @@ char *basename(char *string)
|
||||
case '/' : last_start=fetch+1 ; break ;
|
||||
case 0 : goto out ;
|
||||
}
|
||||
if ( !isascii(ctoken) || !isprint(ctoken) ) {
|
||||
if ( !IsAscii(ctoken) || !isprint(ctoken) ) {
|
||||
werror("non-ascii characters in argument %s",string) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
/* Made into arch/aal by Ceriel Jacobs
|
||||
*/
|
||||
|
||||
static char RcsId[] = "$Id$";
|
||||
|
||||
/*
|
||||
* Usage: [arch|aal] [qdprtx][vlcu] archive [file] ...
|
||||
* v: verbose
|
||||
@@ -35,6 +33,13 @@ static char RcsId[] = "$Id$";
|
||||
#include <arch.h>
|
||||
#include <ranlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
#include "object.h"
|
||||
#include <missing_proto.h>
|
||||
|
||||
#ifdef AAL
|
||||
#include <out.h>
|
||||
#define MAGIC_NUMBER AALMAG
|
||||
@@ -458,7 +463,7 @@ void add(char *name, int fd, char *mess)
|
||||
return;
|
||||
}
|
||||
else if (u_fl && status.st_mtime <= member.ar_date) {
|
||||
wr_arhdr(fd, member);
|
||||
wr_arhdr(fd, &member);
|
||||
copy_member(&member, ar_fd, fd, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,6 @@ int AccFileSpecifier = 0; /* return filespecifier <...> */
|
||||
int AccDefined = 0; /* accept "defined(...)" */
|
||||
int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */
|
||||
|
||||
char *string_token(char *nm, int stop_char);
|
||||
void skipcomment();
|
||||
|
||||
void PushLex()
|
||||
{
|
||||
DOT = 0;
|
||||
@@ -43,6 +40,10 @@ int LLlex()
|
||||
return (DOT != EOF) ? GetToken(&dot) : EOF;
|
||||
}
|
||||
|
||||
#ifdef BUFSIZ
|
||||
#undef BUFSIZ
|
||||
#endif
|
||||
|
||||
#define BUFSIZ 1024
|
||||
|
||||
int GetToken(struct token *ptok)
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
|
||||
#include <em_arith.h>
|
||||
#include "system.h"
|
||||
#include "print.h"
|
||||
|
||||
/* the structure of a token: */
|
||||
struct token {
|
||||
@@ -42,3 +44,34 @@ extern int err_occurred; /* "error.c" */
|
||||
#define DOT dot.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#include <symbol2str.h>
|
||||
struct idf;
|
||||
struct token;
|
||||
|
||||
char *string_token(char *nm, int stop_char);
|
||||
void skipcomment();
|
||||
int GetToken(struct token *ptok);
|
||||
void fatal(char *fmt, ...);
|
||||
void EnableMacros();
|
||||
int replace(struct idf *idef);
|
||||
void error(char *fmt, ...);
|
||||
int quoted(int c);
|
||||
int val_in_base(int c, int base);
|
||||
void crash(char *fmt, ...);
|
||||
void skipline();
|
||||
void warning(char *fmt, ...);
|
||||
void PushLex();
|
||||
void If_expr(void);
|
||||
void PopLex();
|
||||
void add_dependency(char *s);
|
||||
int skipspaces(int ch, int skipnl);
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags);
|
||||
void DoUnstack();
|
||||
void init_pp();
|
||||
void do_option(char *text);
|
||||
void preprocess(char *fn);
|
||||
void domacro();
|
||||
|
||||
/* External */
|
||||
int InsertFile(char *, char **, char **);
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
/* EVALUATION OF BINARY OPERATORS */
|
||||
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
#include <em_arith.h>
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ static void do_undef();
|
||||
static void do_line(unsigned int l);
|
||||
static int getparams(char *buf[], char parbuf[]);
|
||||
static int macroeq(char *s, char *t);
|
||||
void macro_def(struct idf *id, char *text, int nformals, int length, int flags);
|
||||
static char *get_text(char *formals[], int *length);
|
||||
|
||||
/* Externel dependency */
|
||||
@@ -84,7 +83,7 @@ char *GetIdentifier()
|
||||
void domacro()
|
||||
{
|
||||
struct token tk; /* the token itself */
|
||||
register struct idf *id;
|
||||
struct idf *id;
|
||||
|
||||
switch(GetToken(&tk)) { /* select control line action */
|
||||
case IDENTIFIER: /* is it a macro keyword? */
|
||||
@@ -169,8 +168,8 @@ static void skip_block(int to_endif)
|
||||
#ifndef or #elif until the corresponding #endif is
|
||||
seen.
|
||||
*/
|
||||
register int ch;
|
||||
register int skiplevel = nestlevel; /* current nesting level */
|
||||
int ch;
|
||||
int skiplevel = nestlevel; /* current nesting level */
|
||||
struct token tk;
|
||||
struct idf *id;
|
||||
|
||||
@@ -315,7 +314,7 @@ static void do_define()
|
||||
char parbuf[PARBUFSIZE]; /* names of formals */
|
||||
char *repl_text; /* start of the replacement text */
|
||||
int length; /* length of the replacement text */
|
||||
register ch;
|
||||
int ch;
|
||||
|
||||
/* read the #defined macro's name */
|
||||
if (!(str = GetIdentifier())) {
|
||||
@@ -403,7 +402,7 @@ static void do_if()
|
||||
|
||||
static void do_ifdef(int how)
|
||||
{
|
||||
register struct idf *id;
|
||||
struct idf *id;
|
||||
char *str;
|
||||
|
||||
/* how == 1 : ifdef; how == 0 : ifndef
|
||||
@@ -432,8 +431,8 @@ static void do_ifdef(int how)
|
||||
|
||||
static void do_undef()
|
||||
{
|
||||
register struct idf *id;
|
||||
register char *str = GetIdentifier();
|
||||
struct idf *id;
|
||||
char *str = GetIdentifier();
|
||||
|
||||
/* Forget a macro definition. */
|
||||
if (str) {
|
||||
@@ -475,10 +474,10 @@ static int getparams(char *buf[], char parbuf[])
|
||||
Note that the '(' has already been eaten.
|
||||
The names of the formal parameters are stored into parbuf.
|
||||
*/
|
||||
register char **pbuf = &buf[0];
|
||||
register int c;
|
||||
register char *ptr = &parbuf[0];
|
||||
register char **pbuf2;
|
||||
char **pbuf = &buf[0];
|
||||
int c;
|
||||
char *ptr = &parbuf[0];
|
||||
char **pbuf2;
|
||||
|
||||
LoadChar(c);
|
||||
c = skipspaces(c,0);
|
||||
@@ -536,7 +535,7 @@ void macro_def(struct idf *id, char *text, int nformals, int length, int flags)
|
||||
table entry belonging to the name of the macro.
|
||||
A warning is given if the definition overwrites another.
|
||||
*/
|
||||
register struct macro *newdef = id->id_macro;
|
||||
struct macro *newdef = id->id_macro;
|
||||
|
||||
if (newdef) { /* is there a redefinition? */
|
||||
if (macroeq(newdef->mc_text, text))
|
||||
@@ -545,7 +544,7 @@ void macro_def(struct idf *id, char *text, int nformals, int length, int flags)
|
||||
}
|
||||
else {
|
||||
#ifdef DOBITS
|
||||
register char *p = id->id_text;
|
||||
unsigned char *p = (unsigned char *)id->id_text;
|
||||
#define setbit(bx) if (!*p) goto go_on; bits[*p++] |= (bx)
|
||||
setbit(bit0);
|
||||
setbit(bit1);
|
||||
@@ -573,7 +572,7 @@ static int find_name(char *nm, char *index[])
|
||||
"index" if it can be found there. 0 is returned if it is
|
||||
not there.
|
||||
*/
|
||||
register char **ip = &index[0];
|
||||
char **ip = &index[0];
|
||||
|
||||
while (*ip)
|
||||
if (strcmp(nm, *ip++) == 0)
|
||||
@@ -599,10 +598,10 @@ static char *get_text(char *formals[], int *length)
|
||||
identifiers, because they might be replaced by some actual
|
||||
parameter. Other tokens will not be seen as such.
|
||||
*/
|
||||
register int c;
|
||||
register unsigned int text_size;
|
||||
int c;
|
||||
unsigned int text_size;
|
||||
char *text = Malloc(text_size = ITEXTSIZE);
|
||||
register unsigned int pos = 0;
|
||||
unsigned int pos = 0;
|
||||
|
||||
LoadChar(c);
|
||||
|
||||
@@ -639,7 +638,7 @@ static char *get_text(char *formals[], int *length)
|
||||
else
|
||||
if (formals && class(c) == STIDF) {
|
||||
char id_buf[IDFSIZE + 1];
|
||||
register char *idp = id_buf;
|
||||
char *idp = id_buf;
|
||||
int n;
|
||||
|
||||
/* read identifier: it may be a formal parameter */
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
*/
|
||||
/* F I L E I N F O R M A T I O N S T R U C T U R E */
|
||||
|
||||
#ifndef UTIL_CPP_FILE_INFO_H
|
||||
#define UTIL_CPP_FILE_INFO_H
|
||||
|
||||
struct file_info {
|
||||
unsigned int fil_lino;
|
||||
char *fil_name;
|
||||
@@ -16,3 +19,5 @@ struct file_info {
|
||||
#define WorkingDir finfo.fil_wdir
|
||||
|
||||
extern struct file_info finfo; /* input.c */
|
||||
|
||||
#endif /* UTIL_CPP_FILE_INFO_H */
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <system.h>
|
||||
#include <alloc.h>
|
||||
#include "LLlex.h"
|
||||
#include "class.h"
|
||||
#include "macro.h"
|
||||
#include "idf.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "LLlex.h"
|
||||
#include "file_info.h"
|
||||
#include "input.h"
|
||||
#define INP_TYPE struct file_info
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <em_arith.h>
|
||||
#include <assert.h>
|
||||
#include <system.h>
|
||||
#include "LLlex.h"
|
||||
#include "file_info.h"
|
||||
#include "idfsize.h"
|
||||
#include "idf.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <alloc.h>
|
||||
#include "LLlex.h"
|
||||
#include "idfsize.h"
|
||||
#include "class.h"
|
||||
#include "macro.h"
|
||||
@@ -29,7 +30,7 @@ void do_option(char *text)
|
||||
{
|
||||
switch(*text++) {
|
||||
case '-':
|
||||
options[*text] = 1;
|
||||
options[*(unsigned char *)text] = 1;
|
||||
break;
|
||||
case 'u':
|
||||
if (! strcmp(text,"ndef")) {
|
||||
@@ -42,7 +43,7 @@ void do_option(char *text)
|
||||
break;
|
||||
case 'C' : /* comment output */
|
||||
case 'P' : /* run preprocessor stand-alone, without #'s */
|
||||
options[*(text-1)] = 1;
|
||||
options[*(unsigned char *)(text-1)] = 1;
|
||||
break;
|
||||
case 'A' : /* for Amake */
|
||||
case 'd' : /* dependency generation */
|
||||
@@ -56,7 +57,7 @@ void do_option(char *text)
|
||||
break;
|
||||
case 'm':
|
||||
case 'i':
|
||||
options[*(text-1)] = 1;
|
||||
options[*(unsigned char *)(text-1)] = 1;
|
||||
break;
|
||||
|
||||
case 'D' : /* -Dname : predefine name */
|
||||
|
||||
@@ -27,12 +27,11 @@ void Xflush()
|
||||
if (do_preprocess) sys_write(STDOUT, _obuf, OBUFSIZE);
|
||||
}
|
||||
|
||||
void preprocess(fn)
|
||||
char *fn;
|
||||
void preprocess(char *fn)
|
||||
{
|
||||
register int c;
|
||||
register char *op = _obuf;
|
||||
register char *ob = &_obuf[OBUFSIZE];
|
||||
int c;
|
||||
char *op = _obuf;
|
||||
char *ob = &_obuf[OBUFSIZE];
|
||||
char Xbuf[256];
|
||||
int lineno = 0;
|
||||
extern char options[];
|
||||
@@ -45,7 +44,7 @@ void preprocess(fn)
|
||||
/* Generate a line directive communicating the
|
||||
source filename
|
||||
*/
|
||||
register char *p = Xbuf;
|
||||
char *p = Xbuf;
|
||||
|
||||
sprint(p, "%s 1 \"%s\"\n",
|
||||
LINE_PREFIX,
|
||||
@@ -68,7 +67,7 @@ void preprocess(fn)
|
||||
fn = FileName;
|
||||
lineno = LineNumber;
|
||||
if (! options['P']) {
|
||||
register char *p = Xbuf;
|
||||
char *p = Xbuf;
|
||||
|
||||
sprint(p, "%s %d \"%s\"\n",
|
||||
LINE_PREFIX,
|
||||
@@ -140,7 +139,7 @@ void preprocess(fn)
|
||||
break;
|
||||
case STSTR:
|
||||
case STCHAR: {
|
||||
register int stopc = c;
|
||||
int stopc = c;
|
||||
int escaped;
|
||||
|
||||
do {
|
||||
@@ -199,9 +198,9 @@ void preprocess(fn)
|
||||
case STIDF: {
|
||||
extern int idfsize; /* ??? */
|
||||
char buf[IDFSIZE + 1];
|
||||
register char *tg = &buf[0];
|
||||
register char *maxpos = &buf[idfsize];
|
||||
register struct idf *idef;
|
||||
char *tg = &buf[0];
|
||||
char *maxpos = &buf[idfsize];
|
||||
struct idf *idef;
|
||||
|
||||
#define tstmac(bx) if (!(bits[c] & bx)) goto nomac
|
||||
#define cpy if (Unstacked) EnableMacros(); *tg++ = c
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "interface.h"
|
||||
#include "file_info.h"
|
||||
|
||||
#include "LLlex.h"
|
||||
|
||||
#define EOS '\0'
|
||||
#define overflow() (fatal("actual parameter buffer overflow"))
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ static char rcsid[] = "$Id$";
|
||||
#define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t))
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
extern char *core_alloc();
|
||||
extern bool incore;
|
||||
extern int infile;
|
||||
extern int passnumber;
|
||||
@@ -66,12 +65,10 @@ static void read_modul();
|
||||
*/
|
||||
int getfile(char *filename)
|
||||
{
|
||||
unsigned int rd_unsigned2();
|
||||
struct ar_hdr archive_header;
|
||||
unsigned short magic_number;
|
||||
#ifdef SYMDBUG
|
||||
struct stat statbuf;
|
||||
extern int fstat();
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
archname = (char *)0;
|
||||
@@ -189,7 +186,6 @@ static void scan_modul()
|
||||
static bool all_alloc()
|
||||
{
|
||||
struct outhead head;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
|
||||
fatal("no space for module header");
|
||||
@@ -212,8 +208,6 @@ static bool direct_alloc(struct outhead *head)
|
||||
struct outsect *sects;
|
||||
unsigned short nsect = head->oh_nsect;
|
||||
long size, rest;
|
||||
extern ind_t hard_alloc();
|
||||
extern ind_t alloc();
|
||||
|
||||
#ifdef SYMDBUG
|
||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
||||
@@ -282,7 +276,6 @@ static bool putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||
{
|
||||
long flen;
|
||||
ind_t emitindex;
|
||||
extern ind_t alloc();
|
||||
static long zeros[MAXSECT];
|
||||
long zero = zeros[allopiece - ALLOEMIT];
|
||||
|
||||
@@ -320,7 +313,6 @@ static bool putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||
static bool putreloindex(ind_t relooff, long nrelobytes)
|
||||
{
|
||||
ind_t reloindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(relooff) = reloindex;
|
||||
@@ -335,7 +327,6 @@ static bool putreloindex(ind_t relooff, long nrelobytes)
|
||||
static bool putdbugindex(ind_t dbugoff, long ndbugbytes)
|
||||
{
|
||||
ind_t dbugindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(dbugoff) = dbugindex;
|
||||
@@ -410,7 +401,6 @@ static void read_modul()
|
||||
unsigned short nsect, nname;
|
||||
long size;
|
||||
long nchar;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
assert(passnumber == SECOND);
|
||||
assert(!incore);
|
||||
@@ -536,7 +526,6 @@ char *getemit(struct outhead *head, struct outsect *sects, int sectindex)
|
||||
{
|
||||
char *ret;
|
||||
ind_t off;
|
||||
extern char *core_alloc();
|
||||
|
||||
if (!incore) {
|
||||
ret = core_alloc(ALLOMODL, sects[sectindex].os_flen);
|
||||
|
||||
Reference in New Issue
Block a user