Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build/ab.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
MAKENOT4 := $(if $(findstring 3.9999, $(lastword $(sort 3.9999 $(MAKE_VERSION)))),yes,no)
MAKE4.3 := $(if $(findstring 4.3, $(firstword $(sort 4.3 $(MAKE_VERSION)))),yes,no)
MAKE4.1 := $(if $(findstring no_no,$(MAKENOT4)_$(MAKE4.3)),yes,no)

ifeq ($(MAKENOT4),yes)
$(error You need GNU Make 4.x for this (if you're on OSX, use gmake).)
Expand Down
23 changes: 6 additions & 17 deletions build/ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,25 +501,17 @@ def emit_rule(self, ins, outs, cmds=[], label=None):

emit(f"OUTS_{outsn}", "=", *fouts, into=lines)
emit(f"INS_{insn}", "=", *fins, into=lines)
emit(name, ":", f"$(OUTS_{outsn})", into=lines)
emit(hashfile, ":", into=lines)
emit(f"\t@mkdir -p {self.dir}", into=lines)
emit(f"\t@touch {hashfile}", into=lines)
emit(
name,
":",
hashfile,
f"$(OUTS_{outsn})",
into=lines,
)
emit("ifeq ($(MAKE4.3),yes)", into=lines)
emit(
hashfile,
f"$(OUTS_{outsn})",
"&:",
"&:" if len(fouts) > 1 else ":",
f"$(INS_{insn})",
hashfile,
into=lines,
)
emit("else", into=lines)
emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines)
emit(hashfile, ":", f"$(INS_{insn})", into=lines)
emit("endif", into=lines)

if label:
emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines)
Expand Down Expand Up @@ -547,9 +539,6 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
emit(name, ":", *fins, into=lines)

outputFp.write("".join(lines))

if outs:
emit(f"\t$(hide) touch {hashfile}")
emit("")


Expand Down
3 changes: 1 addition & 2 deletions examples/dhry.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
#include <stdlib.h>
/* for exit */
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
/* for strcpy, strcmp */

Expand Down Expand Up @@ -419,8 +420,6 @@ typedef float measure;

#define Null 0
/* Value of a Null pointer */
#define true 1
#define false 0

typedef int One_Thirty;
typedef int One_Fifty;
Expand Down
16 changes: 4 additions & 12 deletions examples/startrek.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,12 @@
#else
#include <stdio.h>
#endif
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#ifndef FALSE
#define FALSE 0
#endif

#ifndef TRUE
#define TRUE ! FALSE
#endif

/* Standard Line Length */

#define MAXLEN 255
Expand All @@ -98,7 +91,6 @@

/* Useful typedefs */

typedef int bool;
typedef char line[MAXCOL];
typedef char string[MAXLEN];

Expand Down Expand Up @@ -222,7 +214,7 @@ string sG2; /* Used to pass string results */

#ifndef SMALL
FILE *stream;
bool bFlag = FALSE; /* Prevent multiple file opens */
bool bFlag = false; /* Prevent multiple file opens */
#endif

void
Expand Down Expand Up @@ -1944,7 +1936,7 @@ openfile(char * sFilename, char * sMode)
return 1;
}

bFlag = TRUE;
bFlag = true;

return 0;
}
Expand All @@ -1955,7 +1947,7 @@ closefile(void)
if (! bFlag)
fclose(stream);

bFlag = FALSE;
bFlag = false;
}

int
Expand Down
4 changes: 2 additions & 2 deletions lang/basic/src/basic.lex
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ int getinputline(void)
/* get next input line */

if ( our_fgets(inputline,MAXLINELENGTH,yyin) == 0)
return(FALSE);
return(false);
yylineno ++;
if ( strchr(inputline,'\n') == 0)
error("source line too long");
inputline[MAXLINELENGTH-1]=0;
if ( listing)
fprintf(stderr, inputline);
cptr= inputline;
return(TRUE);
return(true);
}


Expand Down
2 changes: 0 additions & 2 deletions lang/basic/src/symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#endif

#define NIL 0
#define TRUE 1
#define FALSE 0

#define DEFAULTTYPE 500
#define INTTYPE 501
Expand Down
27 changes: 12 additions & 15 deletions lang/cem/cemcom.ansi/LLlex.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* $Id$ */
/* L E X I C A L A N A L Y Z E R */

#include <stddef.h>
#include <stdbool.h>
#include <assert.h>
#include <alloc.h>
#include <stdlib.h>
Expand All @@ -19,7 +21,7 @@
#include "Lpars.h"
#include "class.h"
#include "sizes.h"
#include "type.h" /* no_long_long() */
#include "type.h" /* no_long_long() */
#include "error.h"
#include "domacro.h"
#include "specials.h" /* registration of special identifiers */
Expand All @@ -38,21 +40,20 @@ int File_Inserted = 0; /* a file has just been inserted */
int LexSave = 0; /* last character read by GetChar */
#define MAX_LL_DEPTH 2

#define FLG_ESEEN 0x01 /* possibly a floating point number */
#define FLG_ESEEN 0x01 /* possibly a floating point number */
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */

#ifdef LINT
extern int lint_skip_comment;
#endif


/* Internal function declarations */
static arith char_constant(char*);
static char* string_token(char *, int , int *);
static char* string_token(char*, int, int*);
static int quoted(int);
static int hex_val(int);
static void strflt2tok(char [], struct token *);
static void strint2tok(char [], struct token *);
static void strflt2tok(char[], struct token*);
static void strint2tok(char[], struct token*);

int LLlex(void)
{
Expand Down Expand Up @@ -85,7 +86,6 @@ int LLlex(void)
return DOT;
}


int GetToken(struct token* ptok)
{
/* GetToken() is the actual token recognizer. It calls the
Expand Down Expand Up @@ -128,8 +128,7 @@ int GetToken(struct token* ptok)
*/
return ptok->tk_symb = EOI;

while ((ch = GetChar()), (ch == '#'
|| class(ch) == STSKIP))
while ((ch = GetChar()), (ch == '#' || class(ch) == STSKIP))
{
/* blanks are allowed before hashes */
if (ch == '#')
Expand Down Expand Up @@ -292,8 +291,7 @@ int GetToken(struct token* ptok)
idef->id_file = ptok->tk_file;
idef->id_line = ptok->tk_line;
ptok->tk_symb
= (idef->id_reserved
? idef->id_reserved
= (idef->id_reserved ? idef->id_reserved
: idef->id_def && idef->id_def->df_sc == TYPEDEF ? TYPE_IDENTIFIER
: IDENTIFIER);
return IDENTIFIER;
Expand Down Expand Up @@ -424,7 +422,7 @@ static arith char_constant(char* nm)
return val;
}

static char* string_token(char *nm, int stop_char, int *plen)
static char* string_token(char* nm, int stop_char, int* plen)
{
int ch;
int str_size;
Expand Down Expand Up @@ -686,7 +684,7 @@ static void strint2tok(char intbuf[], struct token* ptok)
and long, then C89 tries unsigned long, but C99 tries
long long (WG14, Rationale for C99, C99RationaleV5.10.pdf,
6.4.4.1 Integer constants).
This compiler follows C89 when the literal has no
This compiler follows C89 when the literal has no
long long suffix.
*/
cut = 0;
Expand Down Expand Up @@ -727,8 +725,7 @@ static void strint2tok(char intbuf[], struct token* ptok)
fund = ERRONEOUS;
else
{
assert(sizeof(val) > long_size ||
(lnglng_size >= 0 && sizeof(val) > lnglng_size));
assert(sizeof(val) > long_size || (lnglng_size >= 0 && sizeof(val) > lnglng_size));
lexwarning("constant too large for target machine");
cut = 1;
}
Expand Down
69 changes: 36 additions & 33 deletions lang/cem/cemcom.ansi/LLlex.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,61 @@
/* 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 */

/* A token from the input stream is represented by an integer,
called a "symbol", but it may have other information associated
to it.
called a "symbol", but it may have other information associated
to it.
*/
#ifndef LLLEX_H_
#define LLLEX_H_

#include "file_info.h"

/* the structure of a token: */
struct token {
int tok_symb; /* the token itself */
char *tok_file; /* the file it (probably) comes from */
unsigned int tok_line; /* the line it (probably) comes from */
struct token
{
int tok_symb; /* the token itself */
char* tok_file; /* the file it (probably) comes from */
unsigned int tok_line; /* the line it (probably) comes from */
int tok_fund;
union {
struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
struct { /* for STRING */
char *tok_bts; /* row of bytes */
int tok_len; /* length of row of bytes */
union
{
struct idf* tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
struct
{ /* for STRING */
char* tok_bts; /* row of bytes */
int tok_len; /* length of row of bytes */
} tok_string;
writh tok_ival; /* for INTEGER */
char *tok_fval; /* for FLOATING */
writh tok_ival; /* for INTEGER */
char* tok_fval; /* for FLOATING */
} tok_data;
};

#define tk_symb tok_symb
#define tk_file tok_file
#define tk_line tok_line
#define tk_fund tok_fund
#define tk_idf tok_data.tok_idf
#define tk_bts tok_data.tok_string.tok_bts
#define tk_len tok_data.tok_string.tok_len
#define tk_ival tok_data.tok_ival
#define tk_fval tok_data.tok_fval
#define tk_symb tok_symb
#define tk_file tok_file
#define tk_line tok_line
#define tk_fund tok_fund
#define tk_idf tok_data.tok_idf
#define tk_bts tok_data.tok_string.tok_bts
#define tk_len tok_data.tok_string.tok_len
#define tk_ival tok_data.tok_ival
#define tk_fval tok_data.tok_fval

extern struct token dot, ahead, aside;
extern int token_nmb; /* number of the ahead token */
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
extern int token_nmb; /* number of the ahead token */
extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */

extern int EoiForNewline; /* "LLlex.c" */
extern int AccFileSpecifier; /* "LLlex.c" */
extern int File_Inserted; /* "LLlex.c" */
extern int EoiForNewline; /* "LLlex.c" */
extern int AccFileSpecifier; /* "LLlex.c" */
extern int File_Inserted; /* "LLlex.c" */

extern int NoUnstack; /* buffer.c */
extern int NoUnstack; /* buffer.c */

extern int err_occurred; /* "error.c" */
extern int err_occurred; /* "error.c" */

#define DOT dot.tk_symb
#define AHEAD ahead.tk_symb
#define ASIDE aside.tk_symb
#define DOT dot.tk_symb
#define AHEAD ahead.tk_symb
#define ASIDE aside.tk_symb

#define EOF (-1)
#define EOF (-1)

extern int GetChar(void);
extern int LLlex(void);
Expand Down
Loading
Loading