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 {
str[pos++] = '\\';
if (pos == str_size)
str = Srealloc(str, str_size += RSTRSIZE);
str = Srealloc(str,
str_size += RSTRSIZE);
ch = nch;
}
}

View file

@ -450,7 +450,8 @@ field2arith(expp)
register arith bits_in_type = atype->tp_size * 8;
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));
}

View file

@ -105,8 +105,11 @@ ch7bin(expp, oper, expr)
}
if ((*expp)->ex_type->tp_fund == POINTER) {
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);
}
pointer_binary(expp, oper, expr);
}
else {

View file

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

View file

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

View file

@ -246,7 +246,8 @@ type2str(tp)
sprintf(buf, "<NILTYPE>");
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) {
switch (tp->tp_fund) {
case POINTER:

View file

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

View file

@ -225,11 +225,14 @@ intexpr(ivalue, fund)
expr->ex_type = long_type;
break;
case UNSIGNED:
/* We cannot make a test like "ivalue <= max_unsigned"
because, if sizeof(long) == int_size 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 !
/* We cannot make a test like
ivalue <= max_unsigned
because, if
sizeof(long) == int_size
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 =
(ivalue & ~max_unsigned) ? long_type : uint_type;

View file

@ -95,8 +95,10 @@ readfile(filename, size)
char *cbuf; /* pointer to buffer to be returned */
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;
}
if ((*size = sys_fsize(fd)) < 0)
fatal("(readfile) cannot get size of file");
@ -374,8 +376,11 @@ loadbuf()
#ifndef READ_IN_ONE
#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++;
}
#else NOPP
if (FilDes >= 0 && (isize = readblock(FilDes, &ibuf[0])) > 0)
return ipp = &ibuf[1], *ipp++;

View file

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

View file

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

View file

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

View file

@ -46,7 +46,8 @@ stack_level() {
local_level->sl_next = stl;
stl->sl_previous = local_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;
}
@ -143,12 +144,16 @@ unstack_level()
free_def(def);
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 */
idf->id_sdef = sdef->next;
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 */
idf->id_struct = tag->next;
free_tag(tag);
@ -163,8 +168,11 @@ unstack_level()
*/
lastlvl = local_level;
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;
}
free_stack_level(lastlvl);
local_level->sl_next = (struct stack_level *) 0;
level = local_level->sl_level;

View file

@ -258,7 +258,8 @@ for_statement
{
C_df_ilb(l_continue);
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_df_ilb(l_break);
stat_unstack();