some long lines split

This commit is contained in:
dick 1986-03-17 17:47:04 +00:00
parent 021d8d1fec
commit 5880700ab4
14 changed files with 71 additions and 34 deletions

View file

@ -497,7 +497,8 @@ string_token(nm, stop_char)
else { else {
str[pos++] = '\\'; str[pos++] = '\\';
if (pos == str_size) if (pos == str_size)
str = Srealloc(str, str_size += RSTRSIZE); str = Srealloc(str,
str_size += RSTRSIZE);
ch = nch; ch = nch;
} }
} }

View file

@ -450,7 +450,8 @@ field2arith(expp)
register arith bits_in_type = atype->tp_size * 8; register arith bits_in_type = atype->tp_size * 8;
ch7bin(expp, LEFT, ch7bin(expp, LEFT,
intexpr(bits_in_type - fd->fd_width - fd->fd_shift, INT) intexpr(bits_in_type - fd->fd_width - fd->fd_shift,
INT)
); );
ch7bin(expp, RIGHT, intexpr(bits_in_type - fd->fd_width, INT)); ch7bin(expp, RIGHT, intexpr(bits_in_type - fd->fd_width, INT));
} }

View file

@ -105,8 +105,11 @@ ch7bin(expp, oper, expr)
} }
if ((*expp)->ex_type->tp_fund == POINTER) { if ((*expp)->ex_type->tp_fund == POINTER) {
pointer_arithmetic(expp, oper, &expr); pointer_arithmetic(expp, oper, &expr);
if (expr->ex_type->tp_size != (*expp)->ex_type->tp_size) if ( expr->ex_type->tp_size !=
(*expp)->ex_type->tp_size
) {
ch7cast(&expr, CAST, (*expp)->ex_type); ch7cast(&expr, CAST, (*expp)->ex_type);
}
pointer_binary(expp, oper, expr); pointer_binary(expp, oper, expr);
} }
else { else {

View file

@ -113,7 +113,8 @@ ch7mon(oper, expp)
if (is_fp_cst(*expp)) if (is_fp_cst(*expp))
switch_sign_fp(*expp); switch_sign_fp(*expp);
else else
*expp = new_oper((*expp)->ex_type, NILEXPR, oper, *expp); *expp = new_oper((*expp)->ex_type,
NILEXPR, oper, *expp);
break; break;
case '!': case '!':
if ((*expp)->ex_type->tp_fund == FUNCTION) if ((*expp)->ex_type->tp_fund == FUNCTION)

View file

@ -529,8 +529,9 @@ get_text(formals, length)
if (c == '\\') { /* check for "\\\n" */ if (c == '\\') { /* check for "\\\n" */
LoadChar(c); LoadChar(c);
if (c == '\n') { if (c == '\n') {
/* more than one line is used for the /* More than one line is used for the
replacement text. Replace "\\\n" by " ". replacement text.
Replace "\\\n" by " ".
*/ */
text[pos++] = ' '; text[pos++] = ' ';
++LineNumber; ++LineNumber;

View file

@ -246,7 +246,8 @@ type2str(tp)
sprintf(buf, "<NILTYPE>"); sprintf(buf, "<NILTYPE>");
return buf; return buf;
} }
sprintf(buf, "(@%lx, #%ld, &%d) ", tp, (long)tp->tp_size, tp->tp_align); sprintf(buf, "(@%lx, #%ld, &%d) ",
tp, (long)tp->tp_size, tp->tp_align);
while (ops) { while (ops) {
switch (tp->tp_fund) { switch (tp->tp_fund) {
case POINTER: case POINTER:

View file

@ -57,14 +57,16 @@ arith tmp_pointer_var();
int code: indicates whether the expression tree must be int code: indicates whether the expression tree must be
turned into EM code or not. E.g. the expression turned into EM code or not. E.g. the expression
statement "12;" delivers the expression "12" to statement "12;" delivers the expression "12" to
EVAL while this should not result in any EM code EVAL while this should not result in any EM
code
label false_label: label false_label:
label true_label: if the expression is a logical or relational label true_label: if the expression is a logical or relational
expression and if the loop of the program expression and if the loop of the program
depends on the resulting value then EVAL depends on the resulting value then EVAL
generates jumps to the specified program labels, generates jumps to the specified program
in case they are specified (i.e. are non-zero) labels, in case they are specified
(i.e. are non-zero)
*/ */
EVAL(expr, val, code, true_label, false_label) EVAL(expr, val, code, true_label, false_label)
@ -242,7 +244,9 @@ EVAL(expr, val, code, true_label, false_label)
EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL); EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
if (gencode) if (gencode)
if (tp->tp_fund == INT || tp->tp_fund == LONG) { if ( tp->tp_fund == INT
|| tp->tp_fund == LONG
) {
if (tp->tp_unsigned) if (tp->tp_unsigned)
C_rmu(tp->tp_size); C_rmu(tp->tp_size);
else else
@ -279,23 +283,25 @@ EVAL(expr, val, code, true_label, false_label)
EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
if (gencode) { if (gencode) {
/* The operands have the same type */ /* The operands have the same type */
arith size = leftop->ex_type->tp_size;
switch (tp->tp_fund) { switch (tp->tp_fund) {
case INT: case INT:
case LONG: case LONG:
if (leftop->ex_type->tp_unsigned) if (leftop->ex_type->tp_unsigned)
C_cmu(leftop->ex_type->tp_size); C_cmu(size);
else else
C_cmi(leftop->ex_type->tp_size); C_cmi(size);
break; break;
case FLOAT: case FLOAT:
case DOUBLE: case DOUBLE:
C_cmf(leftop->ex_type->tp_size); C_cmf(size);
break; break;
case POINTER: case POINTER:
C_cmp(); C_cmp();
break; break;
case ENUM: case ENUM:
C_cmi(leftop->ex_type->tp_size); C_cmi(size);
break; break;
default: default:
CRASH(); CRASH();
@ -537,10 +543,12 @@ EVAL(expr, val, code, true_label, false_label)
EVAL(leftop, RVAL, TRUE, l_true, l_false); EVAL(leftop, RVAL, TRUE, l_true, l_false);
C_df_ilb(l_true); C_df_ilb(l_true);
EVAL(rightop->OP_LEFT, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop->OP_LEFT, RVAL, code,
NO_LABEL, NO_LABEL);
C_bra(l_end); C_bra(l_end);
C_df_ilb(l_false); C_df_ilb(l_false);
EVAL(rightop->OP_RIGHT, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop->OP_RIGHT, RVAL, code,
NO_LABEL, NO_LABEL);
C_df_ilb(l_end); C_df_ilb(l_end);
break; break;
} }

View file

@ -225,11 +225,14 @@ intexpr(ivalue, fund)
expr->ex_type = long_type; expr->ex_type = long_type;
break; break;
case UNSIGNED: case UNSIGNED:
/* We cannot make a test like "ivalue <= max_unsigned" /* We cannot make a test like
because, if sizeof(long) == int_size holds, max_unsigned ivalue <= max_unsigned
may be a negative long in which case the comparison because, if
results in an unexpected answer. We assume that sizeof(long) == int_size
the type "unsigned long" is not part of portable C ! holds, max_unsigned may be a negative long in
which case the comparison results in an unexpected
answer. We assume that the type "unsigned long"
is not part of portable C !
*/ */
expr->ex_type = expr->ex_type =
(ivalue & ~max_unsigned) ? long_type : uint_type; (ivalue & ~max_unsigned) ? long_type : uint_type;

View file

@ -95,8 +95,10 @@ readfile(filename, size)
char *cbuf; /* pointer to buffer to be returned */ char *cbuf; /* pointer to buffer to be returned */
register tmp; register tmp;
if ((fd = sys_open(filename, OP_RDONLY)) < 0) /* can't open this file */ if ((fd = sys_open(filename, OP_RDONLY)) < 0) {
/* can't open this file */
return (char *) 0; return (char *) 0;
}
if ((*size = sys_fsize(fd)) < 0) if ((*size = sys_fsize(fd)) < 0)
fatal("(readfile) cannot get size of file"); fatal("(readfile) cannot get size of file");
@ -374,8 +376,11 @@ loadbuf()
#ifndef READ_IN_ONE #ifndef READ_IN_ONE
#ifndef NOPP #ifndef NOPP
if (FilDes >= 0 && (head->bh_size = readblock(FilDes, head->bh_text)) > 0) if ( FilDes >= 0
&& (head->bh_size = readblock(FilDes, head->bh_text)) > 0
) {
return ipp = &(head->bh_text[1]), *ipp++; return ipp = &(head->bh_text[1]), *ipp++;
}
#else NOPP #else NOPP
if (FilDes >= 0 && (isize = readblock(FilDes, &ibuf[0])) > 0) if (FilDes >= 0 && (isize = readblock(FilDes, &ibuf[0])) > 0)
return ipp = &ibuf[1], *ipp++; return ipp = &ibuf[1], *ipp++;

View file

@ -309,7 +309,9 @@ preprocess()
lastlineno = dot.tk_line; lastlineno = dot.tk_line;
if (!options['P']) if (!options['P'])
printf("\n#line %ld \"%s\"\n", printf("\n#line %ld \"%s\"\n",
lastlineno, lastfilenm); lastlineno,
lastfilenm
);
} }
} }
else { else {

View file

@ -138,7 +138,8 @@ macro2buffer(idef, actpars, siztext)
text[pos++] = *p; text[pos++] = *p;
if (pos == size) { if (pos == size) {
text = Srealloc(text, size += RSTRSIZE); text = Srealloc(text,
size += RSTRSIZE);
} }
} }
} }

View file

@ -165,7 +165,8 @@ copyact(ch1, ch2, level)
break; break;
case ',': case ',':
if (!level) { /* next parameter encountered */ if (!level) {
/* next parameter encountered */
copy(EOS); copy(EOS);
if (++nr_of_params >= NPARAMS) { if (++nr_of_params >= NPARAMS) {

View file

@ -46,7 +46,8 @@ stack_level() {
local_level->sl_next = stl; local_level->sl_next = stl;
stl->sl_previous = local_level; stl->sl_previous = local_level;
stl->sl_level = ++level; stl->sl_level = ++level;
stl->sl_local_offset = stl->sl_max_block = local_level->sl_local_offset; stl->sl_local_offset =
stl->sl_max_block = local_level->sl_local_offset;
local_level = stl; local_level = stl;
} }
@ -143,12 +144,16 @@ unstack_level()
free_def(def); free_def(def);
update_ahead(idf); update_ahead(idf);
} }
while ((sdef = idf->id_sdef) && sdef->sd_level >= level) { while ( (sdef = idf->id_sdef)
&& sdef->sd_level >= level
) {
/* unlink it from the sdef list under the idf block */ /* unlink it from the sdef list under the idf block */
idf->id_sdef = sdef->next; idf->id_sdef = sdef->next;
free_sdef(sdef); free_sdef(sdef);
} }
while ((tag = idf->id_struct) && tag->tg_level >= level) { while ( (tag = idf->id_struct)
&& tag->tg_level >= level
) {
/* unlink it from the struct list under the idf block */ /* unlink it from the struct list under the idf block */
idf->id_struct = tag->next; idf->id_struct = tag->next;
free_tag(tag); free_tag(tag);
@ -163,8 +168,11 @@ unstack_level()
*/ */
lastlvl = local_level; lastlvl = local_level;
local_level = local_level->sl_previous; local_level = local_level->sl_previous;
if (level > L_LOCAL && lastlvl->sl_max_block < local_level->sl_max_block) if ( level > L_LOCAL
&& lastlvl->sl_max_block < local_level->sl_max_block
) {
local_level->sl_max_block = lastlvl->sl_max_block; local_level->sl_max_block = lastlvl->sl_max_block;
}
free_stack_level(lastlvl); free_stack_level(lastlvl);
local_level->sl_next = (struct stack_level *) 0; local_level->sl_next = (struct stack_level *) 0;
level = local_level->sl_level; level = local_level->sl_level;

View file

@ -258,7 +258,8 @@ for_statement
{ {
C_df_ilb(l_continue); C_df_ilb(l_continue);
if (e_incr) if (e_incr)
code_expr(e_incr, RVAL, FALSE, NO_LABEL, NO_LABEL); code_expr(e_incr, RVAL, FALSE,
NO_LABEL, NO_LABEL);
C_bra(l_test); C_bra(l_test);
C_df_ilb(l_break); C_df_ilb(l_break);
stat_unstack(); stat_unstack();