Skip to content

Commit bdf03b6

Browse files
committed
Format.
1 parent acf284b commit bdf03b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+7726
-7467
lines changed

lang/cem/cemcom.ansi/LLlex.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/* $Id$ */
66
/* L E X I C A L A N A L Y Z E R */
77

8-
#include <stddef.h>
9-
#include <stdbool.h>
8+
#include <stddef.h>
9+
#include <stdbool.h>
1010
#include <assert.h>
1111
#include <alloc.h>
1212
#include <stdlib.h>
@@ -21,7 +21,7 @@
2121
#include "Lpars.h"
2222
#include "class.h"
2323
#include "sizes.h"
24-
#include "type.h" /* no_long_long() */
24+
#include "type.h" /* no_long_long() */
2525
#include "error.h"
2626
#include "domacro.h"
2727
#include "specials.h" /* registration of special identifiers */
@@ -40,21 +40,20 @@ int File_Inserted = 0; /* a file has just been inserted */
4040
int LexSave = 0; /* last character read by GetChar */
4141
#define MAX_LL_DEPTH 2
4242

43-
#define FLG_ESEEN 0x01 /* possibly a floating point number */
43+
#define FLG_ESEEN 0x01 /* possibly a floating point number */
4444
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
4545

4646
#ifdef LINT
4747
extern int lint_skip_comment;
4848
#endif
4949

50-
5150
/* Internal function declarations */
5251
static arith char_constant(char*);
53-
static char* string_token(char *, int , int *);
52+
static char* string_token(char*, int, int*);
5453
static int quoted(int);
5554
static int hex_val(int);
56-
static void strflt2tok(char [], struct token *);
57-
static void strint2tok(char [], struct token *);
55+
static void strflt2tok(char[], struct token*);
56+
static void strint2tok(char[], struct token*);
5857

5958
int LLlex(void)
6059
{
@@ -87,7 +86,6 @@ int LLlex(void)
8786
return DOT;
8887
}
8988

90-
9189
int GetToken(struct token* ptok)
9290
{
9391
/* GetToken() is the actual token recognizer. It calls the
@@ -130,8 +128,7 @@ int GetToken(struct token* ptok)
130128
*/
131129
return ptok->tk_symb = EOI;
132130

133-
while ((ch = GetChar()), (ch == '#'
134-
|| class(ch) == STSKIP))
131+
while ((ch = GetChar()), (ch == '#' || class(ch) == STSKIP))
135132
{
136133
/* blanks are allowed before hashes */
137134
if (ch == '#')
@@ -294,8 +291,7 @@ int GetToken(struct token* ptok)
294291
idef->id_file = ptok->tk_file;
295292
idef->id_line = ptok->tk_line;
296293
ptok->tk_symb
297-
= (idef->id_reserved
298-
? idef->id_reserved
294+
= (idef->id_reserved ? idef->id_reserved
299295
: idef->id_def && idef->id_def->df_sc == TYPEDEF ? TYPE_IDENTIFIER
300296
: IDENTIFIER);
301297
return IDENTIFIER;
@@ -426,7 +422,7 @@ static arith char_constant(char* nm)
426422
return val;
427423
}
428424

429-
static char* string_token(char *nm, int stop_char, int *plen)
425+
static char* string_token(char* nm, int stop_char, int* plen)
430426
{
431427
int ch;
432428
int str_size;
@@ -688,7 +684,7 @@ static void strint2tok(char intbuf[], struct token* ptok)
688684
and long, then C89 tries unsigned long, but C99 tries
689685
long long (WG14, Rationale for C99, C99RationaleV5.10.pdf,
690686
6.4.4.1 Integer constants).
691-
This compiler follows C89 when the literal has no
687+
This compiler follows C89 when the literal has no
692688
long long suffix.
693689
*/
694690
cut = 0;
@@ -729,8 +725,7 @@ static void strint2tok(char intbuf[], struct token* ptok)
729725
fund = ERRONEOUS;
730726
else
731727
{
732-
assert(sizeof(val) > long_size ||
733-
(lnglng_size >= 0 && sizeof(val) > lnglng_size));
728+
assert(sizeof(val) > long_size || (lnglng_size >= 0 && sizeof(val) > lnglng_size));
734729
lexwarning("constant too large for target machine");
735730
cut = 1;
736731
}

lang/cem/cemcom.ansi/LLlex.h

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,61 @@
66
/* 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 */
77

88
/* A token from the input stream is represented by an integer,
9-
called a "symbol", but it may have other information associated
10-
to it.
9+
called a "symbol", but it may have other information associated
10+
to it.
1111
*/
1212
#ifndef LLLEX_H_
1313
#define LLLEX_H_
1414

1515
#include "file_info.h"
1616

1717
/* the structure of a token: */
18-
struct token {
19-
int tok_symb; /* the token itself */
20-
char *tok_file; /* the file it (probably) comes from */
21-
unsigned int tok_line; /* the line it (probably) comes from */
18+
struct token
19+
{
20+
int tok_symb; /* the token itself */
21+
char* tok_file; /* the file it (probably) comes from */
22+
unsigned int tok_line; /* the line it (probably) comes from */
2223
int tok_fund;
23-
union {
24-
struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
25-
struct { /* for STRING */
26-
char *tok_bts; /* row of bytes */
27-
int tok_len; /* length of row of bytes */
24+
union
25+
{
26+
struct idf* tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
27+
struct
28+
{ /* for STRING */
29+
char* tok_bts; /* row of bytes */
30+
int tok_len; /* length of row of bytes */
2831
} tok_string;
29-
writh tok_ival; /* for INTEGER */
30-
char *tok_fval; /* for FLOATING */
32+
writh tok_ival; /* for INTEGER */
33+
char* tok_fval; /* for FLOATING */
3134
} tok_data;
3235
};
3336

34-
#define tk_symb tok_symb
35-
#define tk_file tok_file
36-
#define tk_line tok_line
37-
#define tk_fund tok_fund
38-
#define tk_idf tok_data.tok_idf
39-
#define tk_bts tok_data.tok_string.tok_bts
40-
#define tk_len tok_data.tok_string.tok_len
41-
#define tk_ival tok_data.tok_ival
42-
#define tk_fval tok_data.tok_fval
37+
#define tk_symb tok_symb
38+
#define tk_file tok_file
39+
#define tk_line tok_line
40+
#define tk_fund tok_fund
41+
#define tk_idf tok_data.tok_idf
42+
#define tk_bts tok_data.tok_string.tok_bts
43+
#define tk_len tok_data.tok_string.tok_len
44+
#define tk_ival tok_data.tok_ival
45+
#define tk_fval tok_data.tok_fval
4346

4447
extern struct token dot, ahead, aside;
45-
extern int token_nmb; /* number of the ahead token */
46-
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
48+
extern int token_nmb; /* number of the ahead token */
49+
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
4750

48-
extern int EoiForNewline; /* "LLlex.c" */
49-
extern int AccFileSpecifier; /* "LLlex.c" */
50-
extern int File_Inserted; /* "LLlex.c" */
51+
extern int EoiForNewline; /* "LLlex.c" */
52+
extern int AccFileSpecifier; /* "LLlex.c" */
53+
extern int File_Inserted; /* "LLlex.c" */
5154

52-
extern int NoUnstack; /* buffer.c */
55+
extern int NoUnstack; /* buffer.c */
5356

54-
extern int err_occurred; /* "error.c" */
57+
extern int err_occurred; /* "error.c" */
5558

56-
#define DOT dot.tk_symb
57-
#define AHEAD ahead.tk_symb
58-
#define ASIDE aside.tk_symb
59+
#define DOT dot.tk_symb
60+
#define AHEAD ahead.tk_symb
61+
#define ASIDE aside.tk_symb
5962

60-
#define EOF (-1)
63+
#define EOF (-1)
6164

6265
extern int GetChar(void);
6366
extern int LLlex(void);

lang/cem/cemcom.ansi/LLmessage.c

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
/* $Id$ */
66
/* PARSER ERROR ADMINISTRATION */
77

8-
#include <stddef.h>
9-
#include <stdbool.h>
10-
#include <string.h>
11-
#include <alloc.h>
12-
#include "idf.h"
13-
#include "arith.h"
14-
#include "LLlex.h"
15-
#include "Lpars.h"
16-
#include "error.h"
8+
#include <stddef.h>
9+
#include <stdbool.h>
10+
#include <string.h>
11+
#include <alloc.h>
12+
#include "idf.h"
13+
#include "arith.h"
14+
#include "LLlex.h"
15+
#include "Lpars.h"
16+
#include "error.h"
1717

18-
19-
20-
static void insert_token(int );
18+
static void insert_token(int);
2119

2220
void LLmessage(int tk)
2321
{
@@ -52,23 +50,23 @@ static void insert_token(int tk)
5250

5351
switch (tk)
5452
{
55-
/* The operands need some body */
56-
case IDENTIFIER:
57-
dot.tk_idf = gen_idf();
58-
break;
59-
case TYPE_IDENTIFIER:
60-
dot.tk_idf = str2idf("int", 0);
61-
break;
62-
case STRING:
63-
dot.tk_bts = strdup("");
64-
dot.tk_len = 1;
65-
break;
66-
case INTEGER:
67-
dot.tk_fund = INT;
68-
dot.tk_ival = 1;
69-
break;
70-
case FLOATING:
71-
dot.tk_fval = strdup("0.0");
72-
break;
53+
/* The operands need some body */
54+
case IDENTIFIER:
55+
dot.tk_idf = gen_idf();
56+
break;
57+
case TYPE_IDENTIFIER:
58+
dot.tk_idf = str2idf("int", 0);
59+
break;
60+
case STRING:
61+
dot.tk_bts = strdup("");
62+
dot.tk_len = 1;
63+
break;
64+
case INTEGER:
65+
dot.tk_fund = INT;
66+
dot.tk_ival = 1;
67+
break;
68+
case FLOATING:
69+
dot.tk_fval = strdup("0.0");
70+
break;
7371
}
7472
}

lang/cem/cemcom.ansi/align.h

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,20 @@
88
#include "parameters.h"
99

1010
#ifndef NOCROSS
11-
extern int
12-
short_align, word_align, int_align, long_align,
13-
lnglng_align,
14-
float_align, double_align, lngdbl_align,
15-
pointer_align,
16-
struct_align, union_align;
11+
extern int short_align, word_align, int_align, long_align, lnglng_align, float_align, double_align,
12+
lngdbl_align, pointer_align, struct_align, union_align;
1713
#else /* NOCROSS */
18-
#define short_align ((int)AL_SHORT)
19-
#define word_align ((int)AL_WORD)
20-
#define int_align ((int)AL_INT)
21-
#define long_align ((int)AL_LONG)
22-
#define lnglng_align ((int)AL_LNGLNG)
23-
#define float_align ((int)AL_FLOAT)
24-
#define double_align ((int)AL_DOUBLE)
25-
#define lngdbl_align ((int)AL_LNGDBL)
26-
#define pointer_align ((int)AL_POINTER)
27-
#define struct_align ((int)AL_STRUCT)
28-
#define union_align ((int)AL_UNION)
14+
#define short_align ((int)AL_SHORT)
15+
#define word_align ((int)AL_WORD)
16+
#define int_align ((int)AL_INT)
17+
#define long_align ((int)AL_LONG)
18+
#define lnglng_align ((int)AL_LNGLNG)
19+
#define float_align ((int)AL_FLOAT)
20+
#define double_align ((int)AL_DOUBLE)
21+
#define lngdbl_align ((int)AL_LNGDBL)
22+
#define pointer_align ((int)AL_POINTER)
23+
#define struct_align ((int)AL_STRUCT)
24+
#define union_align ((int)AL_UNION)
2925
#endif /* NOCROSS */
3026

3127
extern arith align(arith pos, int al);

0 commit comments

Comments
 (0)