delinted somewhat

This commit is contained in:
ceriel 1988-10-13 15:43:23 +00:00
parent c08c3e5cf6
commit ce0ec1c143
8 changed files with 50 additions and 51 deletions

View file

@ -400,7 +400,7 @@ again:
*/
enum statetp {Oct,OptHex,Hex,Dec,OctEndOrHex,End,OptReal,Real};
register enum statetp state;
register int base;
register int base = 8;
register char *np = &buf[1];
/* allow a '-' to be added */
@ -416,7 +416,6 @@ again:
LoadChar(ch);
}
if (ch == 'B' || ch == 'C') {
base = 8;
state = OctEndOrHex;
break;
}
@ -480,7 +479,6 @@ again:
UnloadChar(ch);
ch = *--np;
*np++ = '\0';
base = 8;
/* Fall through */
case End: {

View file

@ -10,6 +10,7 @@ MKDEP = $(EMHOME)/bin/mkdep
PRID = $(EMHOME)/bin/prid
CID = $(EMHOME)/bin/cid
CURRDIR = .
LINT = lint
INCLUDES = -I$(MHDIR) -I$(EMHOME)/h -I$(PKGDIR)
OLIBS = $(LIBDIR)/libem_mes.a $(OBJECTCODE) $(LIBDIR)/libinput.a $(LIBDIR)/libassert.a $(LIBDIR)/liballoc.a $(MALLOC) $(LIBDIR)/libprint.a $(LIBDIR)/libstring.a $(LIBDIR)/libsystem.a
@ -20,7 +21,8 @@ GFILES =$(GENGFILES) $(GF)
LLGENOPTIONS = -v
PROFILE =
COPTIONS=
CFLAGS = $(PROFILE) $(INCLUDES) $(COPTIONS) -O -DSTATIC=
OPTIM=-O
CFLAGS = $(PROFILE) $(INCLUDES) $(COPTIONS) $(OPTIM) -DSTATIC=
LINTFLAGS = -DSTATIC= -DNORCSID
MALLOC = $(LIBDIR)/malloc.o
LDFLAGS = -i $(PROFILE)
@ -153,7 +155,7 @@ depend: Cfiles
#INCLINCLINCLINCL
Xlint:
lint $(INCLUDES) $(LINTFLAGS) $(SRC) \
$(LINT) $(INCLUDES) $(LINTFLAGS) $(SRC) \
$(LIBDIR)/llib-lem_mes.ln \
$(LIBDIR)/llib-lemk.ln \
$(LIBDIR)/llib-linput.ln \

View file

@ -480,7 +480,7 @@ CodeStd(nd)
{
register t_node *arg = nd->nd_right;
register t_node *left = 0;
register t_type *tp;
register t_type *tp = 0;
int std = nd->nd_left->nd_def->df_value.df_stdname;
if (arg) {
@ -863,12 +863,10 @@ CodeOper(expr, true_label, false_label)
break;
case OR:
case AND: {
label l_maybe = ++text_label, l_end;
label l_maybe = ++text_label, l_end = NO_LABEL;
t_desig *Des = new_desig();
int genlabels = 0;
if (true_label == NO_LABEL) {
genlabels = 1;
true_label = ++text_label;
false_label = ++text_label;
l_end = ++text_label;
@ -881,7 +879,7 @@ CodeOper(expr, true_label, false_label)
def_ilb(l_maybe);
clear((char *) Des, sizeof(t_desig));
CodeExpr(rightop, Des, true_label, false_label);
if (genlabels) {
if (l_end != NO_LABEL) {
def_ilb(true_label);
c_loc(1);
C_bra(l_end);

View file

@ -68,7 +68,7 @@ cstunary(expp)
expression below it, and the result restored in expp.
*/
register t_node *right = expp->nd_right;
arith o1;
arith o1 = right->nd_INT;
switch(expp->nd_symb) {
/* Should not get here
@ -77,15 +77,15 @@ cstunary(expp)
*/
case '-':
if (right->nd_INT == min_int[(int)(right->nd_type->tp_size)])
if (o1 == min_int[(int)(right->nd_type->tp_size)])
overflow(expp);
o1 = -right->nd_INT;
o1 = -o1;
break;
case NOT:
case '~':
o1 = !right->nd_INT;
o1 = !o1;
break;
default:

View file

@ -27,6 +27,8 @@
#include "Lpars.h"
#include "warning.h"
extern char *sprint();
STATIC
internal(c)
register char *c;
@ -254,7 +256,6 @@ DeclProc(type, id)
*/
register t_def *df;
register t_scope *scope;
extern char *sprint();
static int nmcount;
char buf[256];
@ -338,7 +339,6 @@ DefineLocalModule(id)
register t_scope *sc;
static int modulecount = 0;
char buf[256];
extern char *sprint();
extern int proclevel;
sprint(buf, "_%d%s_", ++modulecount, id->id_text);

View file

@ -105,6 +105,7 @@ GetDefinitionModule(id, incr)
ForeignFlag = 0;
DefId = id;
open_scope(CLOSEDSCOPE);
vis = CurrVis;
if (!strcmp(id->id_text, "SYSTEM")) {
do_SYSTEM();
df = lookup(id, GlobalScope, D_IMPORTED, 0);
@ -138,7 +139,6 @@ GetDefinitionModule(id, incr)
df = lookup(id, GlobalScope, D_IMPORTED, 0);
newsc->sc_name = id->id_text;
}
vis = CurrVis;
}
close_scope(SC_CHKFORW);
if (! df) {

View file

@ -27,6 +27,8 @@
#include "f_info.h"
#include "warning.h"
extern t_def *GetDefinitionModule();
}
/*
The grammar as given by Wirth is already almost LL(1); the
@ -95,8 +97,13 @@ import(int local;)
t_node *ImportList;
register t_node *FromId = 0;
register t_def *df;
extern t_def *GetDefinitionModule();
} :
/*
When parsing a global module, this is the place where we must
read already compiled definition modules.
If the FROM clause is present, the identifier in it is a module
name, otherwise the names in the import list are module names.
*/
[ FROM
IDENT { FromId = dot2leaf(Name);
if (local) {
@ -104,21 +111,16 @@ import(int local;)
}
else df = GetDefinitionModule(dot.TOK_IDF, 1);
}
IMPORT IdentList(&ImportList) ';'
{ EnterFromImportList(ImportList, df, FromId); }
|
IMPORT IdentList(&ImportList) ';'
{ EnterImportList(ImportList,
local,
enclosing(CurrVis)->sc_scope);
}
]
IMPORT IdentList(&ImportList) ';'
/*
When parsing a global module, this is the place where we must
read already compiled definition modules.
If the FROM clause is present, the identifier in it is a module
name, otherwise the names in the import list are module names.
*/
{ if (FromId) {
EnterFromImportList(ImportList, df, FromId);
}
else EnterImportList(ImportList,
local,
enclosing(CurrVis)->sc_scope);
{
FreeNode(ImportList);
}
;
@ -207,7 +209,6 @@ definition
ProgramModule
{
extern t_def *GetDefinitionModule();
register t_def *df;
} :
MODULE

View file

@ -366,7 +366,7 @@ WalkProcedure(procedure)
WalkDefList(procscope->sc_def, UseWarnings);
}
static int
static
WalkDef(df)
register t_def *df;
{
@ -394,7 +394,7 @@ WalkDef(df)
}
}
static int
static
MkCalls(df)
register t_def *df;
{
@ -570,10 +570,8 @@ WalkStat(nd, exit_label)
ForLoopVarExpr(nd);
C_stl(tmp2);
}
}
WalkNode(right, exit_label);
nd->nd_def->df_flags &= ~D_FORLOOP;
if (good_forvar) {
WalkNode(right, exit_label);
nd->nd_def->df_flags &= ~D_FORLOOP;
if (tmp2 != 0) {
label x = ++text_label;
C_lol(tmp2);
@ -598,6 +596,10 @@ WalkStat(nd, exit_label)
CodeDStore(nd);
}
}
else {
WalkNode(right, exit_label);
nd->nd_def->df_flags &= ~D_FORLOOP;
}
C_bra(l1);
def_ilb(l2);
FreeInt(tmp);
@ -830,38 +832,36 @@ DoAssign(left, right)
free_desig(dsr);
}
static int
static
RegisterMessage(df)
register t_def *df;
{
register t_type *tp;
arith sz;
int regtype;
if (df->df_kind == D_VARIABLE) {
if ( !(df->df_flags & D_NOREG)) {
/* Examine type and size
*/
regtype = -1;
tp = BaseType(df->df_type);
if ((df->df_flags & D_VARPAR) ||
(tp->tp_fund&(T_POINTER|T_HIDDEN|T_EQUAL))) {
sz = pointer_size;
regtype = reg_pointer;
C_ms_reg(df->var_off,
pointer_size,
reg_pointer,
0);
}
else if (tp->tp_fund & T_NUMERIC) {
sz = tp->tp_size;
regtype = tp->tp_fund == T_REAL ?
reg_float : reg_any;
}
if (regtype >= 0) {
C_ms_reg(df->var_off, sz, regtype, 0);
C_ms_reg(df->var_off,
tp->tp_size,
tp->tp_fund == T_REAL ?
reg_float : reg_any,
0);
}
}
}
}
static int
static
UseWarnings(df)
register t_def *df;
{