Working on ANSI C frontend...
This commit is contained in:
parent
1c4e04de3a
commit
6e6d9c26b5
@ -22,6 +22,9 @@
|
||||
#include "class.h"
|
||||
#include "assert.h"
|
||||
#include "sizes.h"
|
||||
#include "error.h"
|
||||
#include "domacro.h"
|
||||
#include "replace.h"
|
||||
#include "specials.h" /* registration of special identifiers */
|
||||
|
||||
/* Data about the token yielded */
|
||||
@ -314,7 +317,7 @@ garbage:
|
||||
char *tg = &buf[0];
|
||||
int pos = -1;
|
||||
struct idf *idef;
|
||||
int idfsize; /* ??? */
|
||||
int idfsize = 0; /* ??? */
|
||||
#ifndef NOPP
|
||||
int NoExpandNext = 0;
|
||||
|
||||
@ -712,17 +715,17 @@ void strflt2tok(char fltbuf[], struct token *ptok)
|
||||
char *cp = fltbuf;
|
||||
int malformed = 0;
|
||||
|
||||
while (is_dig(*cp)) cp++;
|
||||
while (is_dig(*(unsigned char *)cp)) cp++;
|
||||
if (*cp == '.') {
|
||||
cp++;
|
||||
while (is_dig(*cp)) cp++;
|
||||
while (is_dig(*(unsigned char *)cp)) cp++;
|
||||
}
|
||||
if (*cp == 'e' || *cp == 'E') {
|
||||
cp++;
|
||||
if (*cp == '+' || *cp == '-')
|
||||
cp++;
|
||||
if (!is_dig(*cp)) malformed++;
|
||||
while (is_dig(*cp)) cp++;
|
||||
if (!is_dig(*(unsigned char *)cp)) malformed++;
|
||||
while (is_dig(*(unsigned char *)cp)) cp++;
|
||||
}
|
||||
if (*cp == 'f' || *cp == 'F') {
|
||||
if (*(cp + 1)) malformed++;
|
||||
@ -766,8 +769,8 @@ void strint2tok(char intbuf[], struct token *ptok)
|
||||
*/
|
||||
ubound = max_arith / (base / 2);
|
||||
|
||||
while (is_hex(*cp)) {
|
||||
dig = hex_val(*cp);
|
||||
while (is_hex(*(unsigned char *)cp)) {
|
||||
dig = hex_val(*(unsigned char *)cp);
|
||||
if (dig >= base) {
|
||||
malformed++; /* ignore */
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_LLLEX_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_LLLEX_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
@ -63,3 +65,21 @@ extern int err_occurred; /* "error.c" */
|
||||
#define ASIDE aside.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
/* lang/cem/cemcom.ansi/LLlex.c */
|
||||
void PushLex(void);
|
||||
void PopLex(void);
|
||||
int LLlex(void);
|
||||
int GetToken(struct token *ptok);
|
||||
void skipcomment(void);
|
||||
arith char_constant(char *nm);
|
||||
char *string_token(char *nm, int stop_char, int *plen);
|
||||
int quoted(int ch);
|
||||
int hex_val(int ch);
|
||||
int GetChar(void);
|
||||
int trigraph(void);
|
||||
void strflt2tok(char fltbuf[], struct token *ptok);
|
||||
void strint2tok(char intbuf[], struct token *ptok);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_LLLEX_H */
|
||||
|
||||
|
||||
85
lang/cem/cemcom.ansi/LLlex.h.new
Normal file
85
lang/cem/cemcom.ansi/LLlex.h.new
Normal file
@ -0,0 +1,85 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_LLLEX_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_LLLEX_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* D E F I N I T I O N S F O R T H E L E X I C A L A N A L Y Z E R */
|
||||
|
||||
/* A token from the input stream is represented by an integer,
|
||||
called a "symbol", but it may have other information associated
|
||||
to it.
|
||||
*/
|
||||
|
||||
#include "file_info.h"
|
||||
#include "nopp.h"
|
||||
|
||||
/* the structure of a token: */
|
||||
struct token {
|
||||
int tok_symb; /* the token itself */
|
||||
char *tok_file; /* the file it (probably) comes from */
|
||||
unsigned int tok_line; /* the line it (probably) comes from */
|
||||
int tok_fund;
|
||||
union {
|
||||
struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
|
||||
struct { /* for STRING */
|
||||
char *tok_bts; /* row of bytes */
|
||||
int tok_len; /* length of row of bytes */
|
||||
} tok_string;
|
||||
arith tok_ival; /* for INTEGER */
|
||||
char *tok_fval; /* for FLOATING */
|
||||
} tok_data;
|
||||
};
|
||||
|
||||
#define tk_symb tok_symb
|
||||
#define tk_file tok_file
|
||||
#define tk_line tok_line
|
||||
#define tk_fund tok_fund
|
||||
#define tk_idf tok_data.tok_idf
|
||||
#define tk_bts tok_data.tok_string.tok_bts
|
||||
#define tk_len tok_data.tok_string.tok_len
|
||||
#define tk_ival tok_data.tok_ival
|
||||
#define tk_fval tok_data.tok_fval
|
||||
|
||||
extern struct token dot, ahead, aside;
|
||||
extern int token_nmb; /* number of the ahead token */
|
||||
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
|
||||
|
||||
#ifndef NOPP
|
||||
extern int ReplaceMacros; /* "LLlex.c" */
|
||||
extern int AccDefined; /* "LLlex.c" */
|
||||
extern int Unstacked; /* "LLlex.c" */
|
||||
extern int UnknownIdIsZero; /* "LLlex.c" */
|
||||
#endif /* NOPP */
|
||||
extern int EoiForNewline; /* "LLlex.c" */
|
||||
extern int AccFileSpecifier; /* "LLlex.c" */
|
||||
extern int File_Inserted; /* "LLlex.c" */
|
||||
|
||||
extern int NoUnstack; /* buffer.c */
|
||||
|
||||
extern int err_occurred; /* "error.c" */
|
||||
|
||||
#define DOT dot.tk_symb
|
||||
#define AHEAD ahead.tk_symb
|
||||
#define ASIDE aside.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
/* lang/cem/cemcom.ansi/LLlex.c */
|
||||
void PushLex(void);
|
||||
void PopLex(void);
|
||||
int LLlex(void);
|
||||
int GetToken(struct token *ptok);
|
||||
void skipcomment(void);
|
||||
arith char_constant(char *nm);
|
||||
char *string_token(char *nm, int stop_char, int *plen);
|
||||
int quoted(int ch);
|
||||
int hex_val(int ch);
|
||||
int GetChar(void);
|
||||
int trigraph(void);
|
||||
void strflt2tok(char fltbuf[], struct token *ptok);
|
||||
void strint2tok(char intbuf[], struct token *ptok);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_LLLEX_H */
|
||||
|
||||
65
lang/cem/cemcom.ansi/LLlex.h.old
Normal file
65
lang/cem/cemcom.ansi/LLlex.h.old
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* D E F I N I T I O N S F O R T H E L E X I C A L A N A L Y Z E R */
|
||||
|
||||
/* A token from the input stream is represented by an integer,
|
||||
called a "symbol", but it may have other information associated
|
||||
to it.
|
||||
*/
|
||||
|
||||
#include "file_info.h"
|
||||
#include "nopp.h"
|
||||
|
||||
/* the structure of a token: */
|
||||
struct token {
|
||||
int tok_symb; /* the token itself */
|
||||
char *tok_file; /* the file it (probably) comes from */
|
||||
unsigned int tok_line; /* the line it (probably) comes from */
|
||||
int tok_fund;
|
||||
union {
|
||||
struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
|
||||
struct { /* for STRING */
|
||||
char *tok_bts; /* row of bytes */
|
||||
int tok_len; /* length of row of bytes */
|
||||
} tok_string;
|
||||
arith tok_ival; /* for INTEGER */
|
||||
char *tok_fval; /* for FLOATING */
|
||||
} tok_data;
|
||||
};
|
||||
|
||||
#define tk_symb tok_symb
|
||||
#define tk_file tok_file
|
||||
#define tk_line tok_line
|
||||
#define tk_fund tok_fund
|
||||
#define tk_idf tok_data.tok_idf
|
||||
#define tk_bts tok_data.tok_string.tok_bts
|
||||
#define tk_len tok_data.tok_string.tok_len
|
||||
#define tk_ival tok_data.tok_ival
|
||||
#define tk_fval tok_data.tok_fval
|
||||
|
||||
extern struct token dot, ahead, aside;
|
||||
extern int token_nmb; /* number of the ahead token */
|
||||
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
|
||||
|
||||
#ifndef NOPP
|
||||
extern int ReplaceMacros; /* "LLlex.c" */
|
||||
extern int AccDefined; /* "LLlex.c" */
|
||||
extern int Unstacked; /* "LLlex.c" */
|
||||
extern int UnknownIdIsZero; /* "LLlex.c" */
|
||||
#endif /* NOPP */
|
||||
extern int EoiForNewline; /* "LLlex.c" */
|
||||
extern int AccFileSpecifier; /* "LLlex.c" */
|
||||
extern int File_Inserted; /* "LLlex.c" */
|
||||
|
||||
extern int NoUnstack; /* buffer.c */
|
||||
|
||||
extern int err_occurred; /* "error.c" */
|
||||
|
||||
#define DOT dot.tk_symb
|
||||
#define AHEAD ahead.tk_symb
|
||||
#define ASIDE aside.tk_symb
|
||||
|
||||
#define EOF (-1)
|
||||
@ -10,8 +10,9 @@
|
||||
#include "arith.h"
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
#include "error.h"
|
||||
|
||||
char *symbol2str(int tok);
|
||||
#include <symbol2str.h>
|
||||
|
||||
void insert_token(int tk);
|
||||
|
||||
|
||||
@ -32,6 +32,10 @@
|
||||
#include "code_c.h"
|
||||
#include "conversion.h"
|
||||
#include "cstoper.h"
|
||||
#include "expr_loc.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <symbol2str.h>
|
||||
|
||||
extern char options[];
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_ARITH_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_ARITH_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
@ -36,9 +38,27 @@ typedef int32_t arith; /* dummy */
|
||||
struct expr;
|
||||
struct type;
|
||||
|
||||
/* lang/cem/cemcom.ansi/arith.c */
|
||||
void arithbalance(struct expr **e1p, int oper, struct expr **e2p);
|
||||
void relbalance(struct expr **e1p, int oper, struct expr **e2p);
|
||||
void ch3pointer(struct expr **expp, int oper, struct type *tp);
|
||||
int any2arith(struct expr **expp, int oper);
|
||||
void erroneous2int(struct expr **expp);
|
||||
struct expr *arith2arith(struct type *tp, int oper, struct expr *expr);
|
||||
int int2int(struct expr **expp, struct type *tp);
|
||||
void int2float(struct expr **expp, struct type *tp);
|
||||
void float2float(struct expr**expp, struct type *tp);
|
||||
void float2int(struct expr **expp, struct type *tp);
|
||||
void float2float(struct expr **expp, struct type *tp);
|
||||
void array2pointer(struct expr *exp);
|
||||
void function2pointer(struct expr *exp);
|
||||
void string2pointer(struct expr *ex);
|
||||
void opnd2integral(struct expr **expp, int oper);
|
||||
void opnd2logical(struct expr **expp, int oper);
|
||||
void opnd2test(struct expr **expp, int oper);
|
||||
void any2opnd(struct expr **expp, int oper);
|
||||
void any2parameter(struct expr **expp);
|
||||
void field2arith(struct expr **expp);
|
||||
void ch3pointer(struct expr **expp, int oper, struct type *tp);
|
||||
void switch_sign_fp(struct expr *expr);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_ARITH_H */
|
||||
|
||||
|
||||
64
lang/cem/cemcom.ansi/arith.h.new
Normal file
64
lang/cem/cemcom.ansi/arith.h.new
Normal file
@ -0,0 +1,64 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_ARITH_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_ARITH_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* COMPILER ARITHMETIC */
|
||||
|
||||
/* Normally the compiler does its internal arithmetics in longs
|
||||
native to the source machine, which is always good for local
|
||||
compilations, and generally OK too for cross compilations
|
||||
downwards and sidewards. For upwards cross compilation and
|
||||
to save storage on small machines, SPECIAL_ARITHMETICS will
|
||||
be handy.
|
||||
*/
|
||||
|
||||
#include "spec_arith.h"
|
||||
|
||||
#ifndef SPECIAL_ARITHMETICS
|
||||
|
||||
#include <em_arith.h> /* obtain definition of "arith" */
|
||||
|
||||
#else /* SPECIAL_ARITHMETICS */
|
||||
|
||||
/* All preprocessor arithmetic should be done in longs.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int32_t arith; /* dummy */
|
||||
|
||||
#endif /* SPECIAL_ARITHMETICS */
|
||||
|
||||
#define arith_size (sizeof(arith))
|
||||
#define arith_sign ((arith) 1 << (arith_size * 8 - 1))
|
||||
#define max_arith (~arith_sign)
|
||||
|
||||
struct expr;
|
||||
struct type;
|
||||
|
||||
/* lang/cem/cemcom.ansi/arith.c */
|
||||
void arithbalance(struct expr **e1p, int oper, struct expr **e2p);
|
||||
void relbalance(struct expr **e1p, int oper, struct expr **e2p);
|
||||
void ch3pointer(struct expr **expp, int oper, struct type *tp);
|
||||
int any2arith(struct expr **expp, int oper);
|
||||
void erroneous2int(struct expr **expp);
|
||||
struct expr *arith2arith(struct type *tp, int oper, struct expr *expr);
|
||||
int int2int(struct expr **expp, struct type *tp);
|
||||
void int2float(struct expr **expp, struct type *tp);
|
||||
void float2int(struct expr **expp, struct type *tp);
|
||||
void float2float(struct expr **expp, struct type *tp);
|
||||
void array2pointer(struct expr *exp);
|
||||
void function2pointer(struct expr *exp);
|
||||
void string2pointer(struct expr *ex);
|
||||
void opnd2integral(struct expr **expp, int oper);
|
||||
void opnd2logical(struct expr **expp, int oper);
|
||||
void opnd2test(struct expr **expp, int oper);
|
||||
void any2opnd(struct expr **expp, int oper);
|
||||
void any2parameter(struct expr **expp);
|
||||
void field2arith(struct expr **expp);
|
||||
void switch_sign_fp(struct expr *expr);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_ARITH_H */
|
||||
|
||||
37
lang/cem/cemcom.ansi/arith.h.old
Normal file
37
lang/cem/cemcom.ansi/arith.h.old
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* COMPILER ARITHMETIC */
|
||||
|
||||
/* Normally the compiler does its internal arithmetics in longs
|
||||
native to the source machine, which is always good for local
|
||||
compilations, and generally OK too for cross compilations
|
||||
downwards and sidewards. For upwards cross compilation and
|
||||
to save storage on small machines, SPECIAL_ARITHMETICS will
|
||||
be handy.
|
||||
*/
|
||||
|
||||
#include "spec_arith.h"
|
||||
|
||||
#ifndef SPECIAL_ARITHMETICS
|
||||
|
||||
#include <em_arith.h> /* obtain definition of "arith" */
|
||||
|
||||
#else /* SPECIAL_ARITHMETICS */
|
||||
|
||||
/* All preprocessor arithmetic should be done in longs.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int32_t arith; /* dummy */
|
||||
|
||||
#endif /* SPECIAL_ARITHMETICS */
|
||||
|
||||
#define arith_size (sizeof(arith))
|
||||
#define arith_sign ((arith) 1 << (arith_size * 8 - 1))
|
||||
#define max_arith (~arith_sign)
|
||||
|
||||
struct expr;
|
||||
struct type;
|
||||
@ -18,6 +18,11 @@
|
||||
#include "label.h"
|
||||
#include "stack.h"
|
||||
#include "Lpars.h"
|
||||
#include "util.h"
|
||||
#include "error.h"
|
||||
#include "idf_loc.h"
|
||||
#include "def.h"
|
||||
|
||||
#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER)
|
||||
#define LocalIntVar() NewLocal(int_size, int_align, reg_any, REGISTER)
|
||||
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
#include "ch3bin.h"
|
||||
#include "decspecs.h"
|
||||
#include "conversion.h"
|
||||
#include "error.h"
|
||||
#include "idf_loc.h"
|
||||
#include "expr_loc.h"
|
||||
#include <symbol2str.h>
|
||||
|
||||
extern char options[];
|
||||
|
||||
@ -22,6 +22,11 @@
|
||||
#include "ch3bin.h"
|
||||
#include "ch3mon.h"
|
||||
#include "cstoper.h"
|
||||
#include "error.h"
|
||||
#include "expr_loc.h"
|
||||
#include "struct_loc.h"
|
||||
#include "fltcstoper.h"
|
||||
|
||||
#include <symbol2str.h>
|
||||
|
||||
extern char options[];
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_DECSPECS_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_DECSPECS_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
@ -19,6 +21,9 @@ struct decspecs {
|
||||
|
||||
extern struct decspecs null_decspecs;
|
||||
|
||||
/* lang/cem/cemcom.ansi/decspecs.c */
|
||||
void do_decspecs(struct decspecs *ds);
|
||||
struct type *qualifier_type(struct type *tp, int typequal);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_DECSPECS_H */
|
||||
|
||||
|
||||
33
lang/cem/cemcom.ansi/decspecs.h.new
Normal file
33
lang/cem/cemcom.ansi/decspecs.h.new
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_DECSPECS_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_DECSPECS_H
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* DECLARATION SPECIFIER DEFINITION */
|
||||
|
||||
struct decspecs {
|
||||
struct decspecs *next;
|
||||
struct type *ds_type; /* single type */
|
||||
int ds_notypegiven; /* set if type not given explicitly */
|
||||
int ds_typedef; /* 1 if type was a user typedef */
|
||||
int ds_sc_given; /* 1 if the st. class is explicitly given */
|
||||
int ds_sc; /* storage class, given or implied */
|
||||
int ds_size; /* LONG, SHORT or 0 */
|
||||
int ds_unsigned; /* SIGNED, UNSIGNED or 0 */
|
||||
int ds_typequal; /* type qualifiers - see type.str */
|
||||
};
|
||||
|
||||
extern struct decspecs null_decspecs;
|
||||
|
||||
void do_decspecs(struct decspecs *ds);
|
||||
struct type *qualifier_type(struct type *tp, int typequal);
|
||||
|
||||
|
||||
/* lang/cem/cemcom.ansi/decspecs.c */
|
||||
void do_decspecs(struct decspecs *ds);
|
||||
struct type *qualifier_type(struct type *tp, int typequal);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_DECSPECS_H */
|
||||
|
||||
24
lang/cem/cemcom.ansi/decspecs.h.old
Normal file
24
lang/cem/cemcom.ansi/decspecs.h.old
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* DECLARATION SPECIFIER DEFINITION */
|
||||
|
||||
struct decspecs {
|
||||
struct decspecs *next;
|
||||
struct type *ds_type; /* single type */
|
||||
int ds_notypegiven; /* set if type not given explicitly */
|
||||
int ds_typedef; /* 1 if type was a user typedef */
|
||||
int ds_sc_given; /* 1 if the st. class is explicitly given */
|
||||
int ds_sc; /* storage class, given or implied */
|
||||
int ds_size; /* LONG, SHORT or 0 */
|
||||
int ds_unsigned; /* SIGNED, UNSIGNED or 0 */
|
||||
int ds_typequal; /* type qualifiers - see type.str */
|
||||
};
|
||||
|
||||
extern struct decspecs null_decspecs;
|
||||
|
||||
void do_decspecs(struct decspecs *ds);
|
||||
struct type *qualifier_type(struct type *tp, int typequal);
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* IDENTIFIER DEFINITION DESCRIPTOR */
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_DEF_STR
|
||||
#define LANG_CEM_CEMCOM_ANSI_DEF_STR
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
@ -38,3 +40,6 @@ struct def { /* for ordinary tags */
|
||||
#define REG_BONUS 10 /* register candidate, declared as such */
|
||||
|
||||
/* ALLOCDEF "def" 50 */
|
||||
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_DEF_STR */
|
||||
31
lang/cem/cemcom.ansi/domacro.h
Normal file
31
lang/cem/cemcom.ansi/domacro.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_DOMACRO_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_DOMACRO_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/domacro.c */
|
||||
struct idf *GetIdentifier(int skiponerr);
|
||||
int domacro(void);
|
||||
int skip_block(int to_endif);
|
||||
int ifexpr(void);
|
||||
int do_include(void);
|
||||
int do_define(void);
|
||||
int push_if(void);
|
||||
int do_elif(void);
|
||||
int do_else(void);
|
||||
int do_endif(void);
|
||||
int do_if(void);
|
||||
int do_ifdef(int how);
|
||||
int do_undef(struct idf *argidf);
|
||||
int do_error(void);
|
||||
int getparams(char *buf[], char parbuf[]);
|
||||
int macro_def(register struct idf *id, char *text, int nformals, int length, int flags);
|
||||
int find_name(char *nm, char *index[]);
|
||||
char *get_text(char *formals[], int *length);
|
||||
int macroeq(register char *s, register char *t);
|
||||
int do_line(unsigned int l);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_DOMACRO_H */
|
||||
|
||||
@ -66,7 +66,7 @@ static _error();
|
||||
|
||||
#if __STDC__
|
||||
/*VARARGS*/
|
||||
error(char *fmt, ...)
|
||||
void error(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -78,7 +78,7 @@ error(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
expr_error(struct expr *expr, char *fmt, ...)
|
||||
void expr_error(struct expr *expr, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -94,7 +94,7 @@ expr_error(struct expr *expr, char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
lexstrict(char *fmt, ...)
|
||||
void lexstrict(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -106,7 +106,7 @@ lexstrict(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
strict(char *fmt, ...)
|
||||
void strict(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -118,7 +118,7 @@ strict(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
expr_strict(struct expr *expr, char *fmt, ...)
|
||||
void expr_strict(struct expr *expr, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -134,7 +134,7 @@ expr_strict(struct expr *expr, char *fmt, ...)
|
||||
|
||||
#ifdef DEBUG
|
||||
/*VARARGS*/
|
||||
debug(char *fmt, ...)
|
||||
void debug(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -147,7 +147,7 @@ debug(char *fmt, ...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*VARARGS*/
|
||||
warning(char *fmt, ...)
|
||||
void warning(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -159,7 +159,7 @@ warning(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
expr_warning(struct expr *expr, char *fmt, ...)
|
||||
void expr_warning(struct expr *expr, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -176,7 +176,7 @@ expr_warning(struct expr *expr, char *fmt, ...)
|
||||
#ifdef LINT
|
||||
|
||||
/*VARARGS*/
|
||||
def_warning(struct def *def, char *fmt, ...)
|
||||
void def_warning(struct def *def, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -189,7 +189,7 @@ def_warning(struct def *def, char *fmt, ...)
|
||||
|
||||
|
||||
/*VARARGS*/
|
||||
hwarning(char *fmt, ...)
|
||||
void hwarning(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -202,7 +202,7 @@ hwarning(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
awarning(char *fmt, ...)
|
||||
void awarning(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -217,7 +217,7 @@ awarning(char *fmt, ...)
|
||||
#endif /* LINT */
|
||||
|
||||
/*VARARGS*/
|
||||
lexerror(char *fmt, ...)
|
||||
void lexerror(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -229,7 +229,7 @@ lexerror(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
lexwarning(char *fmt, ...)
|
||||
void lexwarning(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -241,7 +241,7 @@ lexwarning(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
crash(char *fmt, ...)
|
||||
void crash(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -261,7 +261,7 @@ crash(char *fmt, ...)
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
fatal(char *fmt, ...)
|
||||
void fatal(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
22
lang/cem/cemcom.ansi/error.h
Normal file
22
lang/cem/cemcom.ansi/error.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_ERROR_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_ERROR_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/error.c */
|
||||
void error(char *fmt, ...);
|
||||
void expr_error(struct expr *expr, char *fmt, ...);
|
||||
void lexstrict(char *fmt, ...);
|
||||
void strict(char *fmt, ...);
|
||||
void expr_strict(struct expr *expr, char *fmt, ...);
|
||||
void warning(char *fmt, ...);
|
||||
void expr_warning(struct expr *expr, char *fmt, ...);
|
||||
void lexerror(char *fmt, ...);
|
||||
void lexwarning(char *fmt, ...);
|
||||
void crash(char *fmt, ...);
|
||||
void fatal(char *fmt, ...);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_ERROR_H */
|
||||
|
||||
27
lang/cem/cemcom.ansi/expr_loc.h
Normal file
27
lang/cem/cemcom.ansi/expr_loc.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_EXPR_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_EXPR_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/expr.c */
|
||||
int rank_of(int oper);
|
||||
int dot2expr(struct expr **expp);
|
||||
int idf2expr(register struct expr *expr);
|
||||
int string2expr(register struct expr **expp, char *str, int len);
|
||||
int int2expr(struct expr *expr);
|
||||
int float2expr(register struct expr *expr);
|
||||
struct expr *intexpr(arith ivalue, int fund);
|
||||
int fill_int_expr(register struct expr *ex, arith ivalue, int fund);
|
||||
struct expr *new_oper(struct type *tp, register struct expr *e1, int oper, register struct expr *e2);
|
||||
int chk_cst_expr(struct expr **expp);
|
||||
int init_expression(register struct expr ***eppp, struct expr *expr);
|
||||
int is_ld_cst(register struct expr *expr);
|
||||
int is_cp_cst(struct expr *expr);
|
||||
int is_fp_cst(struct expr *expr);
|
||||
int is_zero_cst(register struct expr *expr);
|
||||
int free_expression(register struct expr *expr);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_EXPR_H */
|
||||
|
||||
12
lang/cem/cemcom.ansi/fltcstoper.h
Normal file
12
lang/cem/cemcom.ansi/fltcstoper.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_FLTCSTOPER_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_FLTCSTOPER_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/fltcstoper.c */
|
||||
int fltcstbin(register struct expr **expp, int oper, register struct expr *expr);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_FLTCSTOPER_H */
|
||||
|
||||
33
lang/cem/cemcom.ansi/idf_loc.h
Normal file
33
lang/cem/cemcom.ansi/idf_loc.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_IDF_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_IDF_H
|
||||
|
||||
#include "declar.h"
|
||||
#include "decspecs.h"
|
||||
#include "def.h"
|
||||
|
||||
/* lang/cem/cemcom.ansi/idf.c */
|
||||
void init_idf(void);
|
||||
struct idf *str2idf(char tg[], int cpy);
|
||||
struct idf *gen_idf(void);
|
||||
int is_anon_idf(struct idf *idf);
|
||||
int declare_idf(struct decspecs *ds, struct declarator *dc, int lvl);
|
||||
int actual_declaration(int sc, struct type *tp);
|
||||
int global_redecl(register struct idf *idf, int new_sc, struct type *tp);
|
||||
int good_formal(register struct def *def, register struct idf *idf);
|
||||
int declare_params(struct declarator *dc);
|
||||
int idf_initialized(register struct idf *idf);
|
||||
int declare_parameter(struct idf *idf);
|
||||
int declare_enum(struct type *tp, struct idf *idf, arith l);
|
||||
int check_formals(struct idf *idf, struct declarator *dc);
|
||||
int declare_formals(struct idf *idf, arith *fp);
|
||||
int regtype(struct type *tp);
|
||||
int add_def(struct idf *idf, int sc, struct type *tp, int lvl);
|
||||
int update_ahead(register struct idf *idf);
|
||||
int free_formals(register struct formal *fm);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_IDF_H */
|
||||
|
||||
29
lang/cem/cemcom.ansi/replace.h
Normal file
29
lang/cem/cemcom.ansi/replace.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_REPLACE_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_REPLACE_H
|
||||
|
||||
struct args;
|
||||
struct repl;
|
||||
|
||||
/* lang/cem/cemcom.ansi/replace.c */
|
||||
int replace(register struct idf *idf);
|
||||
int unstackrepl(void);
|
||||
int freeargs(struct args *args);
|
||||
int EnableMacros(void);
|
||||
int expand_macro(register struct repl *repl, register struct idf *idf);
|
||||
int expand_defined(register struct repl *repl);
|
||||
int newarg(struct args *args);
|
||||
int getactuals(struct repl *repl, register struct idf *idf);
|
||||
int saveraw(struct repl *repl);
|
||||
int actual(struct repl *repl);
|
||||
int macro_func(register struct idf *idef);
|
||||
int macro2buffer(register struct repl *repl, register struct idf *idf, register struct args *args);
|
||||
char *stringify(register struct repl *repl, register char *ptr, register struct args *args);
|
||||
int add2repl(register struct repl *repl, int ch);
|
||||
int stash(struct repl *repl, register int ch, int stashraw);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_REPLACE_H */
|
||||
|
||||
20
lang/cem/cemcom.ansi/struct_loc.h
Normal file
20
lang/cem/cemcom.ansi/struct_loc.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_STRUCT_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_STRUCT_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/struct.c */
|
||||
int add_sel(register struct type *stp, struct type *tp, register struct idf *idf, struct sdef ***sdefpp, arith *szp, struct field *fd);
|
||||
int check_selector(register struct idf *idf, struct type *stp);
|
||||
int declare_struct(int fund, register struct idf *idf, struct type **tpp);
|
||||
int apply_struct(int fund, register struct idf *idf, struct type **tpp);
|
||||
struct sdef *idf2sdef(register struct idf *idf, struct type *tp);
|
||||
arith add_field(arith *szp, register struct field *fd, register struct type **fdtpp, struct idf *idf, register struct type *stp);
|
||||
int is_struct_or_union(register int fund);
|
||||
int gcd(register int m, register int n);
|
||||
int lcm(register int m, register int n);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_STRUCT_H */
|
||||
|
||||
20
lang/cem/cemcom.ansi/util.h
Normal file
20
lang/cem/cemcom.ansi/util.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* The Amsterdam Compiler Kit
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef LANG_CEM_CEMCOM_ANSI_UTIL_H
|
||||
#define LANG_CEM_CEMCOM_ANSI_UTIL_H
|
||||
|
||||
/* lang/cem/cemcom.ansi/util.c */
|
||||
int LocalInit(void);
|
||||
arith LocalSpace(arith sz, int al);
|
||||
arith NewLocal(arith sz, int al, int regtype, int sc);
|
||||
int FreeLocal(arith off);
|
||||
int LocalFinish(void);
|
||||
int RegisterAccount(arith offset, arith size, int regtype, int sc);
|
||||
int LoadLocal(arith off, arith sz);
|
||||
int StoreLocal(arith off, arith sz);
|
||||
int AddrLocal(arith off);
|
||||
|
||||
#endif /* LANG_CEM_CEMCOM_ANSI_UTIL_H */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user