Merge from default.

This commit is contained in:
David Given 2019-02-10 23:40:07 +01:00
commit 34e9573929
28 changed files with 434 additions and 378 deletions

View file

@ -12,13 +12,13 @@ matrix:
sudo: false sudo: false
dist: trusty dist: trusty
compiler: clang compiler: clang
# - -
# os: osx os: osx
# env: HOMEBREW_NO_AUTO_UPDATE=1 env: HOMEBREW_NO_AUTO_UPDATE=1
# compiler: clang compiler: clang
git: git:
depth: 10 depth: 1
script: script:
- make CC=$CC PREFIX=/tmp/acki +ack - make CC=$CC PREFIX=/tmp/acki +ack

View file

@ -34,7 +34,6 @@ struct mkey {
{0, K_UNKNOWN} {0, K_UNKNOWN}
}; };
char *strcpy();
char *sprint(); char *sprint();
init_pp() init_pp()

View file

@ -135,7 +135,7 @@ INSTRUCTIONS
rst const1:ro cost(1,11). rst const1:ro cost(1,11).
/* rz cost(1, 8). */ /* rz cost(1, 8). */
sbb reg1:ro kills a:cc cost(1, 4). sbb reg1:ro kills a:cc cost(1, 4).
/* sbi const1:ro kills a:cc cost(2, 7). */ sbi const1:ro kills a:cc cost(2, 7).
shld label:ro cost(3,16). shld label:ro cost(3,16).
sphl cost(1, 5). sphl cost(1, 5).
sta label:ro cost(3,13). sta label:ro cost(3,13).
@ -623,37 +623,68 @@ pat sde
/****************************************/ /****************************************/
pat adi $1==2 pat adi $1==2
with hlreg dereg with hlreg dereg
gen dad de yields hl gen
with dereg hlreg dad de
gen dad de yields hl yields hl
with hlreg hlreg with dereg hlreg
gen dad hl yields hl gen
with dereg dereg dad de
gen xchg. yields hl
dad hl yields hl with hlreg hlreg
gen
dad hl
yields hl
with dereg dereg
gen
xchg.
dad hl
yields hl
pat adi $1==4 pat adi $1==4
kills ALL kills ALL
gen Call {label,".adi4"} gen
Call {label,".adi4"}
pat sbi $1==2 pat sbi $1==2
with hl_or_de hl_or_de with const2 hl_or_de
uses areg yields %2 {const2, 0-%1.num}
gen mov a,%2.2 leaving
sub %1.2 adi 2
mov %1.2,a with smallconst2 hl_or_de
mov a,%2.1 yields %2 {smallconst2, 0-%1.num}
sbb %1.1 leaving
mov %1.1,a yields %1 adi 2
with hl_or_de hl_or_de with hl_or_de const2
uses areg uses areg
gen mov a,%2.2 gen
sub %1.2 mvi a, {const1, %2.num & 0xff}
mov %2.2,a sub %1.2
mov a,%2.1 mov %1.2, a
sbb %1.1 mvi a, {const1, %2.num >> 8}
mov %2.1,a yields %2 sbb %1.1
mov %1.1, a
yields %1
with hl_or_de hl_or_de
uses areg
gen
mov a,%2.2
sub %1.2
mov %1.2,a
mov a,%2.1
sbb %1.1
mov %1.1,a
yields %1
with hl_or_de hl_or_de
uses areg
gen
mov a,%2.2
sub %1.2
mov %2.2,a
mov a,%2.1
sbb %1.1
mov %2.1,a
yields %2
pat sbi $1==4 pat sbi $1==4
kills ALL kills ALL
@ -702,14 +733,33 @@ pat ngi $1==4
kills ALL kills ALL
gen Call {label,".ngi4"} gen Call {label,".ngi4"}
pat loc sli ($1 == 8) && ($2 == 2) pat loc sli ($1==1) && ($2==2)
with hl_or_de with hlreg
gen move %1.2, %1.1 gen
mvi %1.2, {const1,0} yields %1 dad hl
yields hl
pat loc sli ($1>=2) && ($1<=7) && ($2==2)
with hlreg
gen
dad hl
yields hl
leaving
loc $1-1
sli 2
pat loc sli ($1==8) && ($2==2)
with hl_or_de
gen
mov %1.1, %1.2
mvi %1.2, {const1, 0}
yields %1
pat sli $1==2 pat sli $1==2
kills ALL kills ALL
gen Call {label,".sli2"} yields de gen
Call {label,".sli2"}
yields de
pat sli $1==4 pat sli $1==4
kills ALL kills ALL
@ -761,7 +811,14 @@ kills ALL
gen mvi a,{const1,0} gen mvi a,{const1,0}
Call {label,".dvi4"} Call {label,".dvi4"}
pat slu leaving sli $1 pat loc slu ($2==2)
leaving
loc $1
sli $2
pat slu
leaving
sli $1
pat loc sru ($1 == 8) && ($2 == 2) pat loc sru ($1 == 8) && ($2 == 2)
with hl_or_de with hl_or_de
@ -1791,65 +1848,121 @@ with yields {const2,$1}
leaving bne $2 leaving bne $2
pat bra pat bra
with STACK with STACK
gen jmp {label,$1} gen
jmp {label,$1}
pat blt pat blt
with hl_or_de hl_or_de STACK with const2 hl_or_de STACK
uses areg uses areg
gen mov a,%2.2 gen
sub %1.2 mov a, %2.2
mov a,%2.1 sui {const1, %1.num & 0xff}
sbb %1.1 mov a, %2.1
jm {label,$1} sbi {const1, %1.num >> 8}
jm {label, $1}
pat ble with hl_or_de const2 STACK
with hl_or_de hl_or_de STACK uses areg
uses areg gen
gen mov a,%1.2 mvi a, {const1, %2.num & 0xff}
sub %2.2 sub %1.2
mov a,%1.1 mvi a, {const1, %2.num >> 8}
sbb %2.1 sbb %1.1
jp {label,$1} jm {label, $1}
with hl_or_de hl_or_de STACK
pat beq uses areg
with hl_or_de hl_or_de STACK gen
uses areg mov a,%2.2
gen mov a,%2.2 sub %1.2
cmp %1.2 mov a,%2.1
jnz {label,1f} sbb %1.1
mov a,%2.1 jm {label,$1}
cmp %1.1
jz {label,$1}
1:
pat bne
with hl_or_de hl_or_de STACK
uses areg
gen mov a,%2.2
cmp %1.2
jnz {label,$1}
mov a,%2.1
cmp %1.1
jnz {label,$1}
pat bge
with hl_or_de hl_or_de STACK
uses areg
gen mov a,%2.2
sub %1.2
mov a,%2.1
sbb %1.1
jp {label,$1}
pat bgt pat bgt
with hl_or_de hl_or_de STACK leaving
uses areg exg 2
gen mov a,%1.2 blt $1
sub %2.2
mov a,%1.1 pat bge
sbb %2.1 with const2 hl_or_de STACK
jm {label,$1} uses areg
gen
mov a, %2.2
sui {const1, %1.num & 0xff}
mov a, %2.1
sbi {const1, %1.num >> 8}
jp {label, $1}
with hl_or_de const2 STACK
uses areg
gen
mvi a, {const1, %2.num & 0xff}
sub %1.2
mvi a, {const1, %2.num >> 8}
sbb %1.1
jp {label, $1}
with hl_or_de hl_or_de STACK
uses areg
gen
mov a,%2.2
sub %1.2
mov a,%2.1
sbb %1.1
jp {label,$1}
pat ble
leaving
exg 2
bge $1
pat beq
with const2 hl_or_de STACK
uses areg
gen
mov a, %2.2
cpi {const1, %1.num & 0xff}
jnz {label, 1f}
mov a, %2.1
cpi {const1, %1.num >> 8}
jz {label, $1}
1:
with hl_or_de const2 STACK
leaving
exg 2
beq $1
with hl_or_de hl_or_de STACK
uses areg
gen
mov a,%2.2
cmp %1.2
jnz {label,1f}
mov a,%2.1
cmp %1.1
jz {label,$1}
1:
pat bne
with const2 hl_or_de STACK
uses areg
gen
mov a, %2.2
cpi {const1, %1.num & 0xff}
jnz {label, $1}
mov a, %2.1
cpi {const1, %1.num >> 8}
jnz {label, $1}
with hl_or_de const2 STACK
leaving
exg 2
beq $1
with hl_or_de hl_or_de STACK
uses areg
gen
mov a,%2.2
cmp %1.2
jnz {label,$1}
mov a,%2.1
cmp %1.1
jnz {label,$1}
pat zlt pat zlt
with STACK with STACK
@ -2027,46 +2140,29 @@ gen 1:
/* Group 15: Miscellaneous */ /* Group 15: Miscellaneous */
/******************************************/ /******************************************/
pat asp $1<=0-6 pat asp ($1<=0-12) || ($1>=12)
with STACK with STACK
uses hlreg={const2,$1} uses hlreg={const2,$1}
gen dad sp gen
sphl. dad sp
sphl.
pat asp $1==0-4 pat asp ($1<0) && ($1>0-12)
with STACK with STACK
gen dcx sp gen
dcx sp push hl
dcx sp leaving
dcx sp asp $1+2
pat asp $1==0-2 pat asp $1==0 /* do nothing */
with STACK
gen dcx sp
dcx sp
pat asp $1==0 /* do nothing */ pat asp ($1>0) && ($1<12)
with STACK
pat asp $1==2 uses hlreg
with exact src1or2 gen
with STACK pop hl
gen inx sp leaving
inx sp asp $1-2
pat asp $1==4
with exact src1or2 leaving asp 2
with STACK
gen inx sp
inx sp
inx sp
inx sp
pat asp $1>=6
with exact src1or2 leaving asp $1-2
with STACK
uses hlreg={const2,$1}
gen dad sp
sphl.
pat ass $1==2 pat ass $1==2
with hlreg STACK with hlreg STACK

View file

@ -13,4 +13,6 @@ mvi X, Y : mov X, Z -> mov X, Z ;
xchg : inx h : xchg -> inx d ; xchg : inx h : xchg -> inx d ;
xchg : inx d : xchg -> inx h ; xchg : inx d : xchg -> inx h ;
cpi 0 -> ora a ;
%%; %%;

View file

@ -53,7 +53,6 @@ extern short bflag; /* -b option (no optimizations) */
#endif #endif
extern char *aoutpath INIT("a.out"); extern char *aoutpath INIT("a.out");
extern char temppath[50];
extern FILE *input; extern FILE *input;
extern FILE *tempfile; extern FILE *tempfile;
@ -93,7 +92,6 @@ extern short listcolm; /* column on output */
extern short listeoln INIT(1); extern short listeoln INIT(1);
/* set by endline, tested by emit1 */ /* set by endline, tested by emit1 */
extern FILE *listfile; /* copy of source text */ extern FILE *listfile; /* copy of source text */
extern char listpath[50];
#endif #endif
#ifndef extern #ifndef extern
@ -155,9 +153,6 @@ void emit4(long);
void emitx(valu_t, int); void emitx(valu_t, int);
void emitf(int size, int negative); void emitf(int size, int negative);
void emitstr(int); void emitstr(int);
void ffreopen(char *, FILE *);
FILE *ffcreat(char *);
FILE *fftemp(char *, char *);
void yyerror(const char *); void yyerror(const char *);
void nosect(void); void nosect(void);
void fatal(const char *, ...); void fatal(const char *, ...);

View file

@ -32,12 +32,6 @@ static void commfinish(void);
/* ========== Machine independent C routines ========== */ /* ========== Machine independent C routines ========== */
void stop(void) { void stop(void) {
#if DEBUG < 2
unlink(temppath);
#ifdef LISTING
unlink(listpath);
#endif
#endif
exit(nerrors != 0); exit(nerrors != 0);
} }
@ -78,13 +72,6 @@ main(int argc, char **argv)
fatal("-o needs filename"); fatal("-o needs filename");
aoutpath = argv[i]; aoutpath = argv[i];
break; break;
case 'T':
if (*p != '\0') {
extern char *tmp_dir;
tmp_dir = p;
}
break;
case 'd': case 'd':
#ifdef LISTING #ifdef LISTING
dflag = 0; dflag = 0;
@ -154,11 +141,11 @@ pass_1(int argc, char **argv)
nbits = BITCHUNK; nbits = BITCHUNK;
#endif #endif
tempfile = fftemp(temppath, "asTXXXXXX"); tempfile = tmpfile();
#ifdef LISTING #ifdef LISTING
listmode = dflag; listmode = dflag;
if (listmode & 0440) if (listmode & 0440)
listfile = fftemp(listpath, "asLXXXXXX"); listfile = tmpfile();
#endif #endif
for (ip = keytab; ip->i_type; ip++) for (ip = keytab; ip->i_type; ip++)
item_insert(ip, H_KEY+hash(ip->i_name)); item_insert(ip, H_KEY+hash(ip->i_name));
@ -399,7 +386,7 @@ pass_23(int n)
#ifdef LISTING #ifdef LISTING
listmode >>= 3; listmode >>= 3;
if (listmode & 4) if (listmode & 4)
ffreopen(listpath, listfile); rewind(listfile);
listeoln = 1; listeoln = 1;
#endif #endif
#ifdef THREE_PASS #ifdef THREE_PASS
@ -438,7 +425,7 @@ pass_23(int n)
#ifndef ASLD #ifndef ASLD
newmodule(modulename); newmodule(modulename);
#endif /* ASLD */ #endif /* ASLD */
ffreopen(temppath, tempfile); rewind(tempfile);
yyparse(); yyparse();
commfinish(); commfinish();
machfinish(n); machfinish(n);

View file

@ -8,6 +8,7 @@
* miscellaneous * miscellaneous
*/ */
#include <errno.h>
#include "comm0.h" #include "comm0.h"
#include "comm1.h" #include "comm1.h"
#include "y.tab.h" #include "y.tab.h"
@ -386,39 +387,6 @@ void emitf(int size, int negative)
con_float(stringbuf, size); con_float(stringbuf, size);
} }
/* ---------- Error checked file I/O ---------- */
void ffreopen(char* s, FILE* f)
{
if (freopen(s, "r", f) == NULL)
fatal("can't reopen %s", s);
}
FILE* ffcreat(char* s)
{
FILE* f;
if ((f = fopen(s, "w")) == NULL)
fatal("can't create %s", s);
return (f);
}
#ifndef TMPDIR
#define TMPDIR "/tmp"
#endif
char* tmp_dir = TMPDIR;
FILE* fftemp(char* path, char* tail)
{
char* dir;
if ((dir = getenv("TMPDIR")) == NULL)
dir = tmp_dir;
sprintf(path, "%s/%s", dir, tail);
close(mkstemp(path));
return (ffcreat(path));
}
/* ---------- Error handling ---------- */ /* ---------- Error handling ---------- */
/* ARGSUSED */ /* ARGSUSED */

View file

@ -73,7 +73,7 @@ char opdesc[] = {
LLDEF, /* EX_REGVAR */ LLDEF, /* EX_REGVAR */
}; };
string salloc(),strcpy(),strcat(); string salloc();
string mycat(s1,s2) string s1,s2; { string mycat(s1,s2) string s1,s2; {
register string s; register string s;

View file

@ -31,7 +31,6 @@ File *C_ofp;
#ifndef INCORE #ifndef INCORE
File *C_tfr; File *C_tfr;
char *C_tmpfile; char *C_tmpfile;
char *strcpy(), *strcat();
char *C_ibuf = 0; char *C_ibuf = 0;
long C_current_out; long C_current_out;
#endif #endif

View file

@ -2,6 +2,7 @@
static char rcsidp5[] = "$Id$"; static char rcsidp5[] = "$Id$";
#endif #endif
#include <string.h>
#include "parser.h" #include "parser.h"
#include "Lpars.h" #include "Lpars.h"
@ -40,7 +41,6 @@ PRIVATE
openofile(filename) openofile(filename)
char *filename; char *filename;
{ {
char *strcpy(), *strcat();
strcpy(ofilename,filename); strcpy(ofilename,filename);
strcpy(ofiletemp,filename); strcpy(ofiletemp,filename);
strcat(ofiletemp,".new"); strcat(ofiletemp,".new");

View file

@ -3,6 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
extern uint8_t ram[0x10000]; extern uint8_t ram[0x10000];

View file

@ -579,8 +579,6 @@ cpy(s,p,inserted) register string p; {
return p; return p;
} }
string strcpy();
LLmessage(d) { LLmessage(d) {
/* /*
* d is either 0, in which case the current token has been deleted, * d is either 0, in which case the current token has been deleted,

View file

@ -549,8 +549,6 @@ cpy(s,p,inserted) register string p; {
return p; return p;
} }
string strcpy();
LLmessage(d) { LLmessage(d) {
/* /*
* d is either 0, in which case the current token has been deleted, * d is either 0, in which case the current token has been deleted,

View file

@ -12,8 +12,8 @@
/* User settable options */ /* User settable options */
/****************************************************************************/ /****************************************************************************/
#define FRONTENDS "fe" /* The front-end definitions */ #define FRONTENDS "fe" /* The front-end definitions */
#define TMPNAME "Ack_%x" /* Naming of temp. files */ #define TMPNAME "Ack_%x" /* Naming of temp. files */
/****************************************************************************/ /****************************************************************************/
/* Internal mnemonics, should not be tinkered with */ /* Internal mnemonics, should not be tinkered with */
@ -21,77 +21,76 @@
/* The names of some string variables */ /* The names of some string variables */
#define HOME "EM" #define HOME "EM"
#define RTS "RTS" #define RTS "RTS"
#define HEAD "HEAD" #define HEAD "HEAD"
#define TAIL "TAIL" #define TAIL "TAIL"
#define SRC "SOURCE" #define SRC "SOURCE"
#define LIBVAR "LNAME" #define LIBVAR "LNAME"
#define SUFFIX "SUFFIX" #define SUFFIX "SUFFIX"
/* Intended for flags, possibly in bit fields */ /* Intended for flags, possibly in bit fields */
#define YES 1 #define YES 1
#define NO 0 #define NO 0
#define MAYBE 2 #define MAYBE 2
#define EXTERN extern #define SUFCHAR '.' /* Start of SUFFIX in file name */
#define SPACE ' '
#define TAB '\t'
#define EQUAL '='
#define S_VAR '{' /* Start of variable */
#define C_VAR '}' /* End of variable */
#define A_VAR '?' /* Variable alternative */
#define BSLASH '\\' /* Backslash */
#define STAR '*' /* STAR */
#define C_IN '<' /* Token specifying input */
#define C_OUT '>' /* Token specifying output */
#define S_EXPR '(' /* Start of expression */
#define C_EXPR ')' /* End of expression */
#define M_EXPR ':' /* Middle of two suffix lists */
#define T_EXPR '=' /* Start of tail */
#define SUFCHAR '.' /* Start of SUFFIX in file name */ #define NO_SCAN 0200 /* Bit set in character to defeat recogn. */
#define SPACE ' '
#define TAB '\t'
#define EQUAL '='
#define S_VAR '{' /* Start of variable */
#define C_VAR '}' /* End of variable */
#define A_VAR '?' /* Variable alternative */
#define BSLASH '\\' /* Backslash */
#define STAR '*' /* STAR */
#define C_IN '<' /* Token specifying input */
#define C_OUT '>' /* Token specifying output */
#define S_EXPR '(' /* Start of expression */
#define C_EXPR ')' /* End of expression */
#define M_EXPR ':' /* Middle of two suffix lists */
#define T_EXPR '=' /* Start of tail */
#define NO_SCAN 0200 /* Bit set in character to defeat recogn. */ typedef struct
{
char* p_path; /* points to the full pathname */
int p_keeps : 1; /* The string should be thrown when unused */
int p_keep : 1; /* The file should be thrown away after use */
} path;
typedef struct { #define p_cont(elem) ((path*)l_content(elem))
char *p_path; /* points to the full pathname */
int p_keeps:1; /* The string should be thrown when unused */
int p_keep:1; /* The file should be thrown away after use */
} path ;
#define p_cont(elem) ((path *)l_content(elem))
/* Own routines */ /* Own routines */
/* rmach.c */ /* rmach.c */
void setlist(char *); extern void setlist(char*);
/* svars.c */ /* svars.c */
void setsvar(char *, char *); extern void setsvar(char*, char*);
void setpvar(char *, char *(*)(void)); extern void setpvar(char*, char* (*)(void));
char *getvar(const char *); extern char* getvar(const char*);
/* util.c */ /* util.c */
char *ack_basename(const char *); extern char* ack_basename(const char*);
char *skipblank(char *); extern char* skipblank(char*);
char *firstblank(char *); extern char* firstblank(char*);
void fatal(const char *, ...); extern void fatal(const char*, ...);
void vprint(const char *, ...); extern void vprint(const char*, ...);
void fuerror(const char *, ...); extern void fuerror(const char*, ...);
void werror(const char *, ...); extern void werror(const char*, ...);
void quit(int); extern void quit(int);
char *keeps(const char *); extern char* keeps(const char*);
#define throws(str) free(str) #define throws(str) free(str)
void *getcore(size_t); extern void* getcore(size_t);
void *changecore(void *, size_t); extern void* changecore(void*, size_t);
#define freecore(area) free(area) #define freecore(area) free(area)
#define DEBUG 1 /* Allow debugging of Ack */ #define DEBUG 1 /* Allow debugging of Ack */
#ifndef DEBUG #ifndef DEBUG
# define debug 0 /* To surprise all these 'if ( debug ) 's */ #define debug 0 /* To surprise all these 'if ( debug ) 's */
#else #else
extern int debug ; extern int debug;
#endif #endif

View file

@ -5,16 +5,48 @@
#include "ack.h" #include "ack.h"
#include "list.h" #include "list.h"
#include "trans.h" #include "trans.h"
#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
#undef EXTERN
#define EXTERN
#include "data.h" #include "data.h"
#ifndef NORCSID char* stopsuffix = NULL; /* Suffix to stop at */
static char rcs_data[] = RCS_DATA ; char* machine = NULL; /* The machine id */
char* callname = NULL; /* argv[0] */
char* rts = NULL; /* The runtime-system */
char* rtsuf = NULL; /* The runtime-system module suffix */
char* Optlist = NULL; /* Which optimizers */
list_head arguments = {}; /* List of arguments */
list_head flags = {}; /* List of flags */
list_head tr_list = {}; /* List of transformations */
list_head R_list = {}; /* List of -R flags */
list_head head_list = {}; /* List of suffices for headers */
list_head tail_list = {}; /* List of suffices for tails */
int k_flag = 0; /* Like -k of lint */
int t_flag = 0; /* Preserve intermediate files */
int v_flag = 0; /* Verbose */
int w_flag = 0; /* Don't print warnings */
int nill_flag = 0; /* Don't print file names */
int Optlevel = 0; /* Optimizing */
#ifdef DEBUG
int debug = 0; /* Debugging control */
#endif #endif
int n_error = 0; /* Number of errors encountered */
char* progname = NULL; /* The program call name */
char* outfile = NULL; /* The result file e.g. a.out */
char template[20] = {}; /* The template for temporary file
names */
trf* linker = NULL; /* Pointer to the Loader/Linker */
trf* cpp_trafo = NULL; /* Pointer to C-preprocessor */
path in = {}; /* The current single input pathname */
path out = {}; /* The current output pathname */
path orig = {}; /* The original input path */
char* p_basename = NULL; /* The current basename */
const char* p_suffix = NULL; /* The current input suffix */

View file

@ -2,50 +2,52 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
#ifndef NORCSID
#define RCS_DATA "$Id$"
#endif
EXTERN char *stopsuffix; /* Suffix to stop at */ #ifndef DATA_H
EXTERN char *machine; /* The machine id */ #define DATA_H
EXTERN char *callname; /* argv[0] */
EXTERN char *rts; /* The runtime-system */
EXTERN char *rtsuf; /* The runtime-system module suffix */
EXTERN char *Optlist; /* Which optimizers */
EXTERN list_head arguments; /* List of arguments */ extern char* stopsuffix; /* Suffix to stop at */
EXTERN list_head flags; /* List of flags */ extern char* machine; /* The machine id */
extern char* callname; /* argv[0] */
extern char* rts; /* The runtime-system */
extern char* rtsuf; /* The runtime-system module suffix */
extern char* Optlist; /* Which optimizers */
EXTERN list_head tr_list; /* List of transformations */ extern list_head arguments; /* List of arguments */
extern list_head flags; /* List of flags */
EXTERN list_head R_list; /* List of -R flags */ extern list_head tr_list; /* List of transformations */
EXTERN list_head head_list; /* List of suffices for headers */
EXTERN list_head tail_list; /* List of suffices for tails */
EXTERN int k_flag; /* Like -k of lint */ extern list_head R_list; /* List of -R flags */
EXTERN int t_flag; /* Preserve intermediate files */ extern list_head head_list; /* List of suffices for headers */
EXTERN int v_flag; /* Verbose */ extern list_head tail_list; /* List of suffices for tails */
EXTERN int w_flag; /* Don't print warnings */
EXTERN int nill_flag; /* Don't print file names */ extern int k_flag; /* Like -k of lint */
EXTERN int Optlevel; /* Optimizing */ extern int t_flag; /* Preserve intermediate files */
extern int v_flag; /* Verbose */
extern int w_flag; /* Don't print warnings */
extern int nill_flag; /* Don't print file names */
extern int Optlevel; /* Optimizing */
#ifdef DEBUG #ifdef DEBUG
EXTERN int debug; /* Debugging control */ extern int debug; /* Debugging control */
#endif #endif
EXTERN int n_error; /* Number of errors encountered */ extern int n_error; /* Number of errors encountered */
EXTERN char *progname; /* The program call name */ extern char* progname; /* The program call name */
EXTERN char *outfile; /* The result file e.g. a.out */ extern char* outfile; /* The result file e.g. a.out */
EXTERN char template[20]; /* The template for temporary file extern char template[20]; /* The template for temporary file
names */ names */
EXTERN trf *linker; /* Pointer to the Loader/Linker */ extern trf* linker; /* Pointer to the Loader/Linker */
EXTERN trf *cpp_trafo; /* Pointer to C-preprocessor */ extern trf* cpp_trafo; /* Pointer to C-preprocessor */
EXTERN path in; /* The current single input pathname */ extern path in; /* The current single input pathname */
EXTERN path out; /* The current output pathname */ extern path out; /* The current output pathname */
EXTERN path orig; /* The original input path */ extern path orig; /* The original input path */
EXTERN char *p_basename; /* The current basename */ extern char* p_basename; /* The current basename */
EXTERN const char *p_suffix; /* The current input suffix */ extern const char* p_suffix; /* The current input suffix */
#endif

View file

@ -1,6 +1,8 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
/* machine dependent definitions */ /* machine dependent definitions */
/* the following definitions are for the VAX */ /* the following definitions are for the VAX */
@ -269,17 +271,3 @@ extern short final_state;
extern char *allocate(); extern char *allocate();
extern bucket *lookup(); extern bucket *lookup();
extern bucket *make_bucket(); extern bucket *make_bucket();
/* system variables */
extern int errno;
/* system functions */
extern void free();
extern char *calloc();
extern char *malloc();
extern char *realloc();
extern char *strcpy();

View file

@ -30,6 +30,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#define DEF_LENGTH 8 #define DEF_LENGTH 8
@ -184,8 +185,6 @@ char *
Salloc(str) Salloc(str)
char *str; char *str;
{ {
char *strcpy();
if (str == 0) if (str == 0)
str = ""; str = "";

View file

@ -14,6 +14,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#ifndef DEF_LENGTH #ifndef DEF_LENGTH
#define DEF_LENGTH 8 #define DEF_LENGTH 8
@ -159,8 +160,6 @@ char *
Salloc(str) Salloc(str)
char *str; char *str;
{ {
char *strcpy();
if (str == 0) { if (str == 0) {
str = ""; str = "";
} }

View file

@ -10,6 +10,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#incoude <string.h>
#define BSIZ 1024 #define BSIZ 1024
char *prog; char *prog;
@ -64,7 +65,6 @@ add_name(nm)
char *nm; char *nm;
{ {
struct namelist *nlp = nl, *lnlp = 0, *nnlp; struct namelist *nlp = nl, *lnlp = 0, *nnlp;
char *strcpy();
while (nlp) { while (nlp) {
register i = strcmp(nm, nlp->name); register i = strcmp(nm, nlp->name);

View file

@ -14,6 +14,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
extern char *ProgName; extern char *ProgName;
@ -101,8 +102,6 @@ char *
Salloc(str) Salloc(str)
char *str; char *str;
{ {
char *strcpy();
if (str == 0) if (str == 0)
str = ""; str = "";

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* L E X I C A L A N A L Y Z E R */ /* L E X I C A L A N A L Y Z E R */
#include <string.h>
#include "idfsize.h" #include "idfsize.h"
#include "numsize.h" #include "numsize.h"
#include "strsize.h" #include "strsize.h"
@ -26,7 +27,6 @@ int AccDefined = 0; /* accept "defined(...)" */
int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */ int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */
char *string_token(); char *string_token();
char *strcpy();
PushLex() PushLex()
{ {

View file

@ -5,6 +5,7 @@
*/ */
/* PREPROCESSOR: INITIALIZATION ROUTINES */ /* PREPROCESSOR: INITIALIZATION ROUTINES */
#include <string.h>
#include <system.h> #include <system.h>
#include <alloc.h> #include <alloc.h>
#include "class.h" #include "class.h"
@ -30,8 +31,6 @@ PRIVATE struct mkey {
{0, K_UNKNOWN} {0, K_UNKNOWN}
}; };
char *strcpy();
EXPORT EXPORT
init_pp() init_pp()
{ {

View file

@ -20,7 +20,6 @@
#include "class.h" #include "class.h"
#include "interface.h" #include "interface.h"
char *strcpy(), *strcat();
char *long2str(); char *long2str();
extern int InputLevel; extern int InputLevel;

View file

@ -5,22 +5,23 @@
*/ */
/* M A P . C */ /* M A P . C */
#include <stdlib.h>
#include "types.h" #include "types.h"
#include "map.h" #include "map.h"
short plength; short plength = 0;
short olength; short olength = 0;
short llength; short llength = 0;
short blength; short blength = 0;
short lplength; short lplength = 0;
line_p *lmap; line_p* lmap = NULL;
bblock_p *lbmap; bblock_p* lbmap = NULL;
proc_p *pmap ; /* dynamically allocated array that maps proc_p* pmap = NULL; /* dynamically allocated array that maps
* every proc_id to a proc_p. * every proc_id to a proc_p.
*/ */
obj_p *omap; /* maps obj_id to obj_p */ obj_p* omap = NULL; /* maps obj_id to obj_p */
loop_p *lpmap; /* maps loop_id to loop_p */ loop_p* lpmap = NULL; /* maps loop_id to loop_p */
bblock_p *bmap; /* maps block_id to bblock_p */ bblock_p* bmap = NULL; /* maps block_id to bblock_p */
dblock_p fdblock; /* first dblock */ dblock_p fdblock = NULL; /* first dblock */
proc_p fproc; /* first proc */ proc_p fproc = NULL; /* first proc */

View file

@ -10,61 +10,61 @@
/******** EM Machine capacity parameters ********/ /******** EM Machine capacity parameters ********/
size wsize; size wsize = 0;
size dwsize; size dwsize = 0;
size psize; size psize = 0;
long i_minsw; long i_minsw = 0;
long i_maxsw; long i_maxsw = 0;
unsigned long i_maxuw; unsigned long i_maxuw = 0;
long min_off; long min_off = 0;
long max_off; long max_off = 0;
ptr max_addr; ptr max_addr = 0;
size wsizem1; size wsizem1 = 0;
/******** EM program parameters ********/ /******** EM program parameters ********/
ptr ML; ptr ML = 0;
ptr HB; ptr HB = 0;
ptr DB; ptr DB = 0;
long NProc; long NProc = 0;
long PreIgnMask; long PreIgnMask = 0;
/******** EM machine registers ********/ /******** EM machine registers ********/
long PI; long PI = 0;
ptr PC; ptr PC = 0;
ptr HP; ptr HP = 0;
ptr SP; ptr SP = 0;
ptr LB; ptr LB = 0;
ptr AB; ptr AB = 0;
long ES; long ES = 0;
int ES_def; int ES_def = 0;
int OnTrap; int OnTrap = 0;
long IgnMask; long IgnMask = 0;
long TrapPI; long TrapPI = 0;
char *FRA; char *FRA = NULL;
size FRALimit; size FRALimit = 0;
size FRASize; size FRASize = 0;
int FRA_def; int FRA_def = 0;
/******** The EM Machine Memory ********/ /******** The EM Machine Memory ********/
char *text; char *text = NULL;
char *data; char *data = NULL;
ptr HL; ptr HL = 0;
char *stack; char *stack = NULL;
char *stackML; char *stackML = NULL;
ptr SL; ptr SL = 0;

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#if __STDC__ #if __STDC__
#include <stdarg.h> #include <stdarg.h>
#else #else
@ -17,9 +18,6 @@
#ifdef LOGGING #ifdef LOGGING
extern int strlen();
extern char *strcpy();
extern long mess_id; /* from io.c */ extern long mess_id; /* from io.c */
extern FILE *fcreat_high(); /* from io.c */ extern FILE *fcreat_high(); /* from io.c */

View file

@ -5,6 +5,8 @@
/* $Id$ */ /* $Id$ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h> #include <setjmp.h>
#include <em_abs.h> #include <em_abs.h>
@ -20,10 +22,6 @@
#include "opcode.h" #include "opcode.h"
#include "rsb.h" #include "rsb.h"
extern int atoi();
extern long atol();
extern char *strcpy();
char mess_file[64] = "int.mess"; /* name of message file */ char mess_file[64] = "int.mess"; /* name of message file */
jmp_buf trapbuf; jmp_buf trapbuf;