Added grind support
This commit is contained in:
parent
97a7fcbca3
commit
3015fc2542
|
@ -98,3 +98,4 @@ type.c
|
||||||
type.str
|
type.str
|
||||||
util.str
|
util.str
|
||||||
util.c
|
util.c
|
||||||
|
stab.c
|
||||||
|
|
|
@ -143,4 +143,8 @@
|
||||||
!File: regcount.h
|
!File: regcount.h
|
||||||
#undef REGCOUNT 1 /* count occurrences for register messages */
|
#undef REGCOUNT 1 /* count occurrences for register messages */
|
||||||
|
|
||||||
|
!File: dbsymtab.h
|
||||||
|
#define DBSYMTAB 1 /* ability to produce symbol table for debugger
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -144,3 +144,8 @@
|
||||||
#undef REGCOUNT 1 /* count occurrences for register messages */
|
#undef REGCOUNT 1 /* count occurrences for register messages */
|
||||||
|
|
||||||
|
|
||||||
|
!File: dbsymtab.h
|
||||||
|
#undef DBSYMTAB 1 /* ability to produce symbol table for debugger
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ the same as \fB\-D\fIname\fR=1.
|
||||||
insert \fIdirname\fR in the list of include directories.
|
insert \fIdirname\fR in the list of include directories.
|
||||||
.IP \fB\-M\fP\fIn\fP
|
.IP \fB\-M\fP\fIn\fP
|
||||||
set maximum identifier length to \fIn\fP.
|
set maximum identifier length to \fIn\fP.
|
||||||
|
.IP \fB\-g\fP
|
||||||
|
produce a DBX-style symbol table.
|
||||||
.IP \fB\-n\fR
|
.IP \fB\-n\fR
|
||||||
do not generate EM register messages.
|
do not generate EM register messages.
|
||||||
The user-declared variables are not stored into registers on the target
|
The user-declared variables are not stored into registers on the target
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
/* C O D E - G E N E R A T I N G R O U T I N E S */
|
/* C O D E - G E N E R A T I N G R O U T I N E S */
|
||||||
|
|
||||||
#include "lint.h"
|
#include "lint.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
#ifndef LINT
|
#ifndef LINT
|
||||||
#include <em.h>
|
#include <em.h>
|
||||||
#else
|
#else
|
||||||
|
@ -34,7 +35,10 @@
|
||||||
#include "atw.h"
|
#include "atw.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "noRoption.h"
|
#include "noRoption.h"
|
||||||
#include "file_info.h"
|
#include "LLlex.h"
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
|
||||||
label lab_count = 1;
|
label lab_count = 1;
|
||||||
label datlab_count = 1;
|
label datlab_count = 1;
|
||||||
|
@ -68,6 +72,24 @@ init_code(dst_file)
|
||||||
fatal("cannot write to %s\n", dst_file);
|
fatal("cannot write to %s\n", dst_file);
|
||||||
C_magic();
|
C_magic();
|
||||||
C_ms_emx(word_size, pointer_size);
|
C_ms_emx(word_size, pointer_size);
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
extern char *source;
|
||||||
|
|
||||||
|
C_ms_std(source, N_SO, 0);
|
||||||
|
stb_typedef(int_type, "int");
|
||||||
|
stb_typedef(char_type, "char");
|
||||||
|
stb_typedef(long_type, "long");
|
||||||
|
stb_typedef(short_type, "short");
|
||||||
|
stb_typedef(uchar_type, "unsigned char");
|
||||||
|
stb_typedef(ushort_type, "unsigned short");
|
||||||
|
stb_typedef(ulong_type, "unsigned long");
|
||||||
|
stb_typedef(uint_type, "unsigned int");
|
||||||
|
stb_typedef(float_type, "float");
|
||||||
|
stb_typedef(double_type, "double");
|
||||||
|
stb_typedef(void_type, "void");
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
#ifdef USE_TMP
|
#ifdef USE_TMP
|
||||||
#ifdef PREPEND_SCOPES
|
#ifdef PREPEND_SCOPES
|
||||||
C_insertpart(tmp_id = C_getid());
|
C_insertpart(tmp_id = C_getid());
|
||||||
|
@ -257,6 +279,14 @@ begin_proc(ds, idf) /* to be called when entering a procedure */
|
||||||
C_fil_dlb(file_name_label, (arith)0);
|
C_fil_dlb(file_name_label, (arith)0);
|
||||||
C_lin((arith)LineNumber);
|
C_lin((arith)LineNumber);
|
||||||
}
|
}
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_string(def, FUNCTION, name);
|
||||||
|
if (! strcmp(name, "main")) {
|
||||||
|
C_ms_stb_cst(name, N_MAIN, 0, (arith) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
end_proc(fbytes)
|
end_proc(fbytes)
|
||||||
|
@ -339,6 +369,9 @@ do_return()
|
||||||
probably smarter than generating a direct return.
|
probably smarter than generating a direct return.
|
||||||
Return sequences may be expensive.
|
Return sequences may be expensive.
|
||||||
*/
|
*/
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
C_bra(return2_label);
|
C_bra(return2_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,8 +420,14 @@ code_declaration(idf, expr, lvl, sc)
|
||||||
register arith size = def->df_type->tp_size;
|
register arith size = def->df_type->tp_size;
|
||||||
int def_sc = def->df_sc;
|
int def_sc = def->df_sc;
|
||||||
|
|
||||||
if (def_sc == TYPEDEF) /* no code for typedefs */
|
if (def_sc == TYPEDEF) { /* no code for typedefs */
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_typedef(def->df_type, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (sc == EXTERN && expr && !is_anon_idf(idf))
|
if (sc == EXTERN && expr && !is_anon_idf(idf))
|
||||||
error("%s is extern; cannot initialize", idf->id_text);
|
error("%s is extern; cannot initialize", idf->id_text);
|
||||||
if (lvl == L_GLOBAL) { /* global variable */
|
if (lvl == L_GLOBAL) { /* global variable */
|
||||||
|
@ -418,6 +457,11 @@ code_declaration(idf, expr, lvl, sc)
|
||||||
/* they are handled on the spot and get an
|
/* they are handled on the spot and get an
|
||||||
integer label in EM.
|
integer label in EM.
|
||||||
*/
|
*/
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && ! expr) {
|
||||||
|
stb_string(def, sc, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
C_df_dlb((label)def->df_address);
|
C_df_dlb((label)def->df_address);
|
||||||
if (expr) { /* there is an initialisation */
|
if (expr) { /* there is an initialisation */
|
||||||
}
|
}
|
||||||
|
@ -436,6 +480,11 @@ code_declaration(idf, expr, lvl, sc)
|
||||||
break;
|
break;
|
||||||
case AUTO:
|
case AUTO:
|
||||||
case REGISTER:
|
case REGISTER:
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_string(def, sc, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
if (expr)
|
if (expr)
|
||||||
loc_init(expr, idf);
|
loc_init(expr, idf);
|
||||||
break;
|
break;
|
||||||
|
@ -511,6 +560,11 @@ bss(idf)
|
||||||
#ifndef PREPEND_SCOPES
|
#ifndef PREPEND_SCOPES
|
||||||
code_scope(idf->id_text, idf->id_def);
|
code_scope(idf->id_text, idf->id_def);
|
||||||
#endif PREPEND_SCOPES
|
#endif PREPEND_SCOPES
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_string(idf->id_def, idf->id_def->df_sc, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
/* Since bss() is only called if df_alloc is non-zero, and
|
/* Since bss() is only called if df_alloc is non-zero, and
|
||||||
since df_alloc is only non-zero if size >= 0, we have:
|
since df_alloc is only non-zero if size >= 0, we have:
|
||||||
*/
|
*/
|
||||||
|
@ -558,6 +612,9 @@ code_expr(expr, val, code, tlbl, flbl)
|
||||||
#ifndef LINT
|
#ifndef LINT
|
||||||
if (! options['L']) /* profiling */
|
if (! options['L']) /* profiling */
|
||||||
C_lin((arith)(expr->ex_line));
|
C_lin((arith)(expr->ex_line));
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(expr->ex_file, (unsigned int)expr->ex_line);
|
||||||
|
#endif
|
||||||
EVAL(expr, val, code, tlbl, flbl);
|
EVAL(expr, val, code, tlbl, flbl);
|
||||||
#else LINT
|
#else LINT
|
||||||
lint_expr(expr, code ? USED : IGNORED);
|
lint_expr(expr, code ? USED : IGNORED);
|
||||||
|
@ -583,6 +640,9 @@ code_break()
|
||||||
{
|
{
|
||||||
register struct stmt_block *stmt_block = stmt_stack;
|
register struct stmt_block *stmt_block = stmt_stack;
|
||||||
|
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
if (stmt_block)
|
if (stmt_block)
|
||||||
C_bra(stmt_block->st_break);
|
C_bra(stmt_block->st_break);
|
||||||
else
|
else
|
||||||
|
@ -600,6 +660,9 @@ code_continue()
|
||||||
|
|
||||||
while (stmt_block) {
|
while (stmt_block) {
|
||||||
if (stmt_block->st_continue) {
|
if (stmt_block->st_continue) {
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
C_bra(stmt_block->st_continue);
|
C_bra(stmt_block->st_continue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -651,3 +714,19 @@ prc_exit()
|
||||||
C_asp(pointer_size);
|
C_asp(pointer_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
db_line(file, line)
|
||||||
|
char *file;
|
||||||
|
unsigned int line;
|
||||||
|
{
|
||||||
|
static unsigned oldline;
|
||||||
|
static char *oldfile;
|
||||||
|
|
||||||
|
if (file != oldfile || line != oldline) {
|
||||||
|
C_ms_std((char *) 0, N_SLINE, (int) line);
|
||||||
|
oldline = line;
|
||||||
|
oldfile = file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
#include "lint.h"
|
#include "lint.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#include "nobitfield.h"
|
#include "nobitfield.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -223,8 +224,19 @@ initializer(struct idf *idf; int sc;)
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
change_state(idf, SET);
|
change_state(idf, SET);
|
||||||
#endif LINT
|
#endif LINT
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && level >= L_LOCAL && expr) {
|
||||||
|
db_line(expr->ex_file, (unsigned) expr->ex_line)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
code_declaration(idf, expr, level, sc);
|
code_declaration(idf, expr, level, sc);
|
||||||
}
|
}
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && globalflag) {
|
||||||
|
stb_string(idf->id_def, sc, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
init_idf(idf);
|
init_idf(idf);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -318,6 +330,13 @@ enum_specifier(register struct type **tpp;)
|
||||||
[
|
[
|
||||||
{declare_struct(ENUM, idf, tpp);}
|
{declare_struct(ENUM, idf, tpp);}
|
||||||
enumerator_pack(*tpp, &l)
|
enumerator_pack(*tpp, &l)
|
||||||
|
{
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_tag(idf->id_enum, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /*DBSYMTAB */
|
||||||
|
}
|
||||||
|
|
|
|
||||||
{apply_struct(ENUM, idf, tpp);}
|
{apply_struct(ENUM, idf, tpp);}
|
||||||
empty
|
empty
|
||||||
|
@ -383,6 +402,11 @@ struct_or_union_specifier(register struct type **tpp;)
|
||||||
struct_declaration_pack(*tpp)
|
struct_declaration_pack(*tpp)
|
||||||
{
|
{
|
||||||
(idf->id_struct->tg_busy)--;
|
(idf->id_struct->tg_busy)--;
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_tag(idf->id_struct, idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /*DBSYMTAB */
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{apply_struct(fund, idf, tpp);}
|
{apply_struct(fund, idf, tpp);}
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
int IncludeLevel = 0;
|
||||||
|
extern char options[];
|
||||||
|
#endif
|
||||||
|
|
||||||
IMPORT char **inctable; /* list of include directories */
|
IMPORT char **inctable; /* list of include directories */
|
||||||
IMPORT char *getwdir();
|
IMPORT char *getwdir();
|
||||||
|
@ -269,6 +275,12 @@ do_include()
|
||||||
FileName = result;
|
FileName = result;
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
nestlow = nestlevel;
|
nestlow = nestlevel;
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
IncludeLevel++;
|
||||||
|
if (options['g']) {
|
||||||
|
C_ms_std(FileName, N_BINCL, 0);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,11 +638,16 @@ declare_formals(fp)
|
||||||
*/
|
*/
|
||||||
f_offset = align(f_offset + def->df_type->tp_size, (int) word_size);
|
f_offset = align(f_offset + def->df_type->tp_size, (int) word_size);
|
||||||
formal_cvt(def); /* cvt int to char or short, if necessary */
|
formal_cvt(def); /* cvt int to char or short, if necessary */
|
||||||
se = se->next;
|
|
||||||
def->df_level = L_FORMAL2; /* CJ */
|
def->df_level = L_FORMAL2; /* CJ */
|
||||||
RegisterAccount(def->df_address, def->df_type->tp_size,
|
RegisterAccount(def->df_address, def->df_type->tp_size,
|
||||||
regtype(def->df_type),
|
regtype(def->df_type),
|
||||||
def->df_sc);
|
def->df_sc);
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) {
|
||||||
|
stb_string(def, FORMAL, se->se_idf->id_text);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
se = se->next;
|
||||||
}
|
}
|
||||||
*fp = f_offset;
|
*fp = f_offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,13 @@ extern int nestlevel;
|
||||||
#include "nopp.h"
|
#include "nopp.h"
|
||||||
#include <inp_pkg.body>
|
#include <inp_pkg.body>
|
||||||
|
|
||||||
|
#include "dbsymtab.h"
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
extern int IncludeLevel;
|
||||||
|
extern char options[];
|
||||||
|
#endif
|
||||||
char *
|
char *
|
||||||
getwdir(fn)
|
getwdir(fn)
|
||||||
register char *fn;
|
register char *fn;
|
||||||
|
@ -64,6 +70,12 @@ AtEoIF()
|
||||||
if (NoUnstack) lexerror("unexpected EOF");
|
if (NoUnstack) lexerror("unexpected EOF");
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
nestlevel = nestlow;
|
nestlevel = nestlow;
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && IncludeLevel > 0) {
|
||||||
|
C_ms_std(FileName, N_EINCL, 0);
|
||||||
|
}
|
||||||
|
IncludeLevel--;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,6 +265,10 @@ compile(argc, argv)
|
||||||
init();
|
init();
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
nestlow = -1;
|
nestlow = -1;
|
||||||
|
#ifndef LINT
|
||||||
|
init_code(destination && strcmp(destination, "-") != 0 ?
|
||||||
|
destination : 0);
|
||||||
|
#endif
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
WorkingDir = getwdir(source);
|
WorkingDir = getwdir(source);
|
||||||
#endif NOPP
|
#endif NOPP
|
||||||
|
@ -279,8 +283,6 @@ compile(argc, argv)
|
||||||
#endif DEBUG
|
#endif DEBUG
|
||||||
{
|
{
|
||||||
#ifndef LINT
|
#ifndef LINT
|
||||||
init_code(destination && strcmp(destination, "-") != 0 ?
|
|
||||||
destination : 0);
|
|
||||||
/* compile the source text */
|
/* compile the source text */
|
||||||
C_program();
|
C_program();
|
||||||
#ifdef PREPEND_SCOPES
|
#ifdef PREPEND_SCOPES
|
||||||
|
|
|
@ -4,12 +4,13 @@ C while running preprocessor, copy comment
|
||||||
d perform a small dataflow analysis
|
d perform a small dataflow analysis
|
||||||
D see identifier following as a macro
|
D see identifier following as a macro
|
||||||
E run preprocessor only
|
E run preprocessor only
|
||||||
|
g produce symbol table for debugger
|
||||||
i suppress /usr/include include files in dependency list
|
i suppress /usr/include include files in dependency list
|
||||||
I expand include table with directory name following
|
I expand include table with directory name following
|
||||||
|
L don't generate linenumbers and filename indications
|
||||||
m generate file.o: file1.h format dependency lines
|
m generate file.o: file1.h format dependency lines
|
||||||
M set identifier length
|
M set identifier length
|
||||||
n don't generate register messages
|
n don't generate register messages
|
||||||
L don't generate linenumbers and filename indications
|
|
||||||
p trace
|
p trace
|
||||||
P in running the preprocessor do not output '# line' lines
|
P in running the preprocessor do not output '# line' lines
|
||||||
R restricted C
|
R restricted C
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "use_tmp.h"
|
#include "use_tmp.h"
|
||||||
#include "dataflow.h"
|
#include "dataflow.h"
|
||||||
#include "noRoption.h"
|
#include "noRoption.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
extern char **inctable;
|
extern char **inctable;
|
||||||
|
@ -103,6 +104,12 @@ next_option: /* to allow combined one-char options */
|
||||||
break;
|
break;
|
||||||
#endif NOPP
|
#endif NOPP
|
||||||
#endif LINT
|
#endif LINT
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
case 'g': /* symbol table for debugger */
|
||||||
|
options['g'] = 1;
|
||||||
|
options['n'] = 1;
|
||||||
|
break;
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
|
||||||
case 'R': /* strict version */
|
case 'R': /* strict version */
|
||||||
#ifndef NOROPTION
|
#ifndef NOROPTION
|
||||||
|
|
|
@ -61,7 +61,9 @@ SRC_C = \
|
||||||
$(SRC_DIR)/switch.c \
|
$(SRC_DIR)/switch.c \
|
||||||
$(SRC_DIR)/tokenname.c \
|
$(SRC_DIR)/tokenname.c \
|
||||||
$(SRC_DIR)/type.c \
|
$(SRC_DIR)/type.c \
|
||||||
$(SRC_DIR)/util.c
|
$(SRC_DIR)/util.c \
|
||||||
|
$(SRC_DIR)/stab.c
|
||||||
|
|
||||||
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
|
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
|
||||||
symbol2str.c char.c Lpars.c next.c
|
symbol2str.c char.c Lpars.c next.c
|
||||||
CFILES= $(SRC_C) $(GEN_C)
|
CFILES= $(SRC_C) $(GEN_C)
|
||||||
|
@ -96,7 +98,7 @@ GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
|
||||||
regcount.h \
|
regcount.h \
|
||||||
code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
|
code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
|
||||||
idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
|
idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
|
||||||
l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h
|
l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h dbsymtab.h
|
||||||
|
|
||||||
HFILES= $(GEN_H) $(SRC_H)
|
HFILES= $(GEN_H) $(SRC_H)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "botch_free.h"
|
#include "botch_free.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
|
|
||||||
#include "arith.h"
|
#include "arith.h"
|
||||||
#include "LLlex.h"
|
#include "LLlex.h"
|
||||||
|
@ -26,8 +27,12 @@
|
||||||
#include "code.h"
|
#include "code.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
|
||||||
extern int level;
|
extern int level;
|
||||||
|
extern char options[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Each statement construction is stacked in order to trace a ???
|
/* Each statement construction is stacked in order to trace a ???
|
||||||
|
@ -451,7 +456,14 @@ jump
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
compound_statement:
|
compound_statement
|
||||||
|
{
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
static int brc_level = 1;
|
||||||
|
int decl_seen = brc_level == 1;
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
}
|
||||||
|
:
|
||||||
'{'
|
'{'
|
||||||
{
|
{
|
||||||
stack_level();
|
stack_level();
|
||||||
|
@ -460,13 +472,32 @@ compound_statement:
|
||||||
(DOT == IDENTIFIER && AHEAD == IDENTIFIER))
|
(DOT == IDENTIFIER && AHEAD == IDENTIFIER))
|
||||||
/* >>> conflict on TYPE_IDENTIFIER, IDENTIFIER */
|
/* >>> conflict on TYPE_IDENTIFIER, IDENTIFIER */
|
||||||
declaration
|
declaration
|
||||||
|
{
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
decl_seen++;
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
}
|
||||||
]*
|
]*
|
||||||
|
{
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
++brc_level;
|
||||||
|
if (options['g'] && decl_seen) {
|
||||||
|
C_ms_std((char *) 0, N_LBRAC, brc_level);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
|
}
|
||||||
[%persistent
|
[%persistent
|
||||||
statement
|
statement
|
||||||
]*
|
]*
|
||||||
'}'
|
'}'
|
||||||
{
|
{
|
||||||
unstack_level();
|
unstack_level();
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && decl_seen) {
|
||||||
|
C_ms_std((char *) 0, N_RBRAC, brc_level);
|
||||||
|
}
|
||||||
|
brc_level--;
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "nofloat.h"
|
#include "nofloat.h"
|
||||||
#include "nobitfield.h"
|
#include "nobitfield.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
|
|
||||||
struct type {
|
struct type {
|
||||||
struct type *next; /* used only with ARRAY */
|
struct type *next; /* used only with ARRAY */
|
||||||
|
@ -22,6 +23,9 @@ struct type {
|
||||||
struct type *tp_pointer;/* to POINTER */
|
struct type *tp_pointer;/* to POINTER */
|
||||||
struct type *tp_array; /* to ARRAY */
|
struct type *tp_array; /* to ARRAY */
|
||||||
struct type *tp_function;/* to FUNCTION */
|
struct type *tp_function;/* to FUNCTION */
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
int tp_dbindex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct type
|
extern struct type
|
||||||
|
|
Loading…
Reference in a new issue