Skip to content

Commit

Permalink
Rip out all the system library file stuff in favour of standard stdio.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Dec 8, 2024
1 parent 96e3657 commit 514140f
Show file tree
Hide file tree
Showing 111 changed files with 274 additions and 671 deletions.
6 changes: 3 additions & 3 deletions doc/ceg/ceg.tr
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ struct t_operand *op;
case BX : R233( 0x0, reg, 0x7);
break;

default : fprint( STDERR, "Wrong index register %d\en",
default : fprint( stderr, "Wrong index register %d\en",
op->reg);
}
else {
Expand All @@ -1208,7 +1208,7 @@ struct t_operand *op;
case BX : R233( 0x1, reg, 0x7);
break;

default : fprint( STDERR, "Wrong index register %d\en",
default : fprint( stderr, "Wrong index register %d\en",
op->reg);
}
@text1( %$(op->expr));
Expand All @@ -1226,7 +1226,7 @@ struct t_operand *op;
case BX : R233( 0x2, reg, 0x7);
break;

default : fprint( STDERR, "Wrong index register %d\en",
default : fprint( stderr, "Wrong index register %d\en",
op->reg);
}
@text2( %$(op->expr));
Expand Down
2 changes: 1 addition & 1 deletion fast/f_c.ansi/Parameters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion fast/f_c/Parameters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion fast/f_m2/Parameters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion fast/f_pc/Parameters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define MAXERR_LINE 5 /* maximum number of error messages given
on the same input line. */

Expand Down
2 changes: 1 addition & 1 deletion fcc/cemcom/Parameters.sun3
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion fcc/cemcom/Parameters.vax4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
8 changes: 4 additions & 4 deletions lang/basic/src/basic.lex
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ char fgets_buf[GETSBUFSIZE];



char *our_fgets(char* buffer, int n_char, File* stream)
char *our_fgets(char* buffer, int n_char, FILE* stream)
{
/* Read one line or n_char */
static int characters_left = 0;
Expand All @@ -217,10 +217,10 @@ char *our_fgets(char* buffer, int n_char, File* stream)
return(buffer);
}
} else { /* Read new block */
sys_read(stream,fgets_buf,GETSBUFSIZE,&characters_left);
characters_left = fread(fgets_buf, 1, GETSBUFSIZE, stream);
internal_bufp = fgets_buf;
/* Move pointer back to the beginning */
if ( characters_left == 0 ) { /* Nothing read */
if ( characters_left <= 0 ) { /* Nothing read */
if ( external_bufp == buffer ) {
*external_bufp = '\0';
return(0); /* EOF */
Expand All @@ -244,7 +244,7 @@ int getinputline(void)
error("source line too long");
inputline[MAXLINELENGTH-1]=0;
if ( listing)
fprint(STDERR, inputline);
fprint(stderr, inputline);
cptr= inputline;
return(TRUE);
}
Expand Down
6 changes: 3 additions & 3 deletions lang/basic/src/bem.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ extern char *outfile; /* output from compiler */

extern char datfname[MAXFILENAME]; /* data statements file */

extern File *emfile; /* EM output file */
extern File *datfile; /* data file */
extern File *yyin; /* Compiler input */
extern FILE *emfile; /* EM output file */
extern FILE *datfile; /* data file */
extern FILE *yyin; /* Compiler input */

extern int endofinput;
extern int wflag;
Expand Down
4 changes: 2 additions & 2 deletions lang/basic/src/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern void LLparse(void);
/* compile the next program in the list */
/* Here we should open the input file. (for the future) */

File *yyin;
FILE* yyin;

void compileprogram(void)
{
Expand All @@ -34,5 +34,5 @@ void compileprogram(void)
LLparse();
}
epilogcode();
sys_close(yyin);
fclose(yyin);
}
4 changes: 2 additions & 2 deletions lang/basic/src/gencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,8 @@ void prolog2(void)
C_csa((arith)BEMINTSIZE);
C_df_ilb((label)0);
C_asp((arith)BEMINTSIZE);
result= sys_open(datfname, OP_WRITE, &datfile);
if ( result==0 ) fatal("improper file creation permission");
datfile = fopen(datfname, "w+b");
if (!datfile) fatal("improper file creation permission");
gendata();
}

Expand Down
2 changes: 1 addition & 1 deletion lang/basic/src/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void linewarnings(void)
{
if ( !srchline(l->linenr))
{
fprint(STDERR, "ERROR: line %d not defined\n",l->linenr);
fprint(stderr, "ERROR: line %d not defined\n",l->linenr);
errorcnt++;
}
l=l->nextlist;
Expand Down
10 changes: 5 additions & 5 deletions lang/basic/src/initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ static char rcs_id[] = "$Id$";

/* generate temporary files etc */

File *datfile;
FILE *datfile;

extern void fillkex(void);

void initialize(void)
{
char *cindex, *cptr;
int result1, result2;
int result;

/* Find the basename */
/* Strip leading directories */
Expand All @@ -40,9 +40,9 @@ void initialize(void)
if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0;
strcat(datfname,".d");
C_init((arith)BEMINTSIZE, (arith)BEMPTRSIZE);
result1 = sys_open(inpfile, OP_READ, &yyin);
result2 = C_open(outfile);
if ( result1==0 || result2== 0 )
yyin = fopen(inpfile, "r");
result = C_open(outfile);
if ( !yyin || result== 0 )
fatal("Improper file permissions");
C_magic();
fillkex(); /* initialize symbol table */
Expand Down
8 changes: 4 additions & 4 deletions lang/basic/src/llmess.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void error_char(char *format,char ch)
extern int listing,errorcnt;
extern int basicline;

if ( !listing ) fprint(STDERR, "LINE %d:",basicline);
fprint(STDERR, format,ch);
if ( !listing ) fprint(stderr, "LINE %d:",basicline);
fprint(stderr, format,ch);
errorcnt++;
}

Expand All @@ -30,8 +30,8 @@ void error_string(char* format,char* str)
extern int listing,errorcnt;
extern int basicline;

if ( !listing ) fprint(STDERR, "LINE %d:",basicline);
fprint(STDERR, format,str);
if ( !listing ) fprint(stderr, "LINE %d:",basicline);
fprint(stderr, format,str);
errorcnt++;
}

Expand Down
4 changes: 2 additions & 2 deletions lang/basic/src/parsepar.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void parseparams(int argc,char **argv)

if(argc< 4)
{
fprint(STDERR,"usage %s <flags> <file> <file> <source>\n",
fprint(stderr,"usage %s <flags> <file> <file> <source>\n",
argv[0]);
sys_stop(S_EXIT);
}
Expand All @@ -46,7 +46,7 @@ void parseparams(int argc,char **argv)
case 't': traceflag++;
break; /* line tracing */
case 'h': /* split EM file */
fprint(STDERR,
fprint(stderr,
"h option not implemented\n");
break;
case 'd': debug++;
Expand Down
4 changes: 2 additions & 2 deletions lang/basic/src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ static void Xerror(char *type, char *str)
extern int listing;
extern int basicline;

if( !listing) fprint(STDERR, "LINE %d:",basicline);
fprint(STDERR, "%s:%s\n",type, str);
if( !listing) fprint(stderr, "LINE %d:",basicline);
fprint(stderr, "%s:%s\n",type, str);
}


Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom.ansi/BigPars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom.ansi/SmallPars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom.ansi/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void unstack_world(void)
list is generated.
*/
extern char *nmlist; /* BAH! -- main.c */
static File *nfp = 0;
static FILE* nfp = 0;

void open_name_list(void)
{
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom/BigPars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom/SmallPars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 5 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cemcom/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ char **inctable;

extern int do_dependencies;
extern char *dep_file;
static File *dep_fd = STDOUT;
static FILE* dep_fd = stdout;

extern char *getwdir();
#endif /* NOPP */
Expand Down
6 changes: 3 additions & 3 deletions lang/cem/cemcom/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ unstack_world()
list is generated.
*/
extern char *nmlist; /* BAH! -- main.c */
static File *nfp = 0;
static FILE* nfp = 0;

open_name_list()
{
Expand All @@ -278,7 +278,7 @@ namelist(nm)
char *nm;
{
if (nmlist) {
sys_write(nfp, nm, strlen(nm));
sys_write(nfp, "\n", 1);
fwrite(nm, 1, strlen(nm), nfp);
fputc('\n', nfp);
}
}
10 changes: 6 additions & 4 deletions lang/cem/cpp.ansi/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern int do_dependencies;
extern char *dep_file;
int idfsize = IDFSIZE;
extern char options[];
static File *dep_fd;
static FILE* dep_fd;

arith ifval;

Expand All @@ -50,7 +50,7 @@ int main(int argc, char *argv[])
{
/* parse and interpret the command line options */
prog_name = argv[0];
dep_fd = STDOUT;
dep_fd = stdout;

init_idf();

Expand Down Expand Up @@ -130,8 +130,10 @@ static void list_dependencies(char *source)
}
else source = 0;
}
if (dep_file && !sys_open(dep_file, OP_WRITE, &dep_fd)) {
fatal("could not open %s", dep_file);
if (dep_file) {
dep_fd = fopen(dep_file, "w+");
if (!dep_fd)
fatal("could not open %s", dep_file);
}
while (p) {
assert(p->id_resmac == K_FILE);
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/cpp.ansi/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define PATHLENGTH 1024 /* max. length of path to file */


#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define MAXERR_LINE 5 /* maximum number of error messages given
on the same input line. */

Expand Down
4 changes: 2 additions & 2 deletions lang/cem/cpp.ansi/preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extern int InputLevel;

void Xflush(void)
{
sys_write(STDOUT, _obuf, OBUFSIZE);
fwrite(_obuf, 1, OBUFSIZE, stdout);
}

static char* SkipComment(char *op, int *lineno);
Expand Down Expand Up @@ -135,7 +135,7 @@ void preprocess(char *fn)
int lineno = 0;
int startline;

#define flush(X) (sys_write(STDOUT, _obuf, X))
#define flush(X) (fwrite(_obuf, 1, X, stdout))
#define echo(ch) \
if (op == ob) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/lint/lpass1.ansi/Parameters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 0 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
2 changes: 1 addition & 1 deletion lang/cem/lint/lpass1/Parameters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERROUT stderr /* file pointer for writing messages */
#define ERR_SHADOW 0 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
Expand Down
Loading

0 comments on commit 514140f

Please sign in to comment.