Merge pull request #152 from davidgiven/dtrg-osx

Enable OSX builds again.
This commit is contained in:
David Given 2019-02-10 16:40:16 +01:00 committed by GitHub
commit 608e386ca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 209 additions and 251 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,7 @@
* miscellaneous
*/
#include <errno.h>
#include "comm0.h"
#include "comm1.h"
#include "y.tab.h"
@ -386,39 +387,6 @@ void emitf(int size, int negative)
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 ---------- */
/* ARGSUSED */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,8 +12,8 @@
/* User settable options */
/****************************************************************************/
#define FRONTENDS "fe" /* The front-end definitions */
#define TMPNAME "Ack_%x" /* Naming of temp. files */
#define FRONTENDS "fe" /* The front-end definitions */
#define TMPNAME "Ack_%x" /* Naming of temp. files */
/****************************************************************************/
/* Internal mnemonics, should not be tinkered with */
@ -21,77 +21,76 @@
/* The names of some string variables */
#define HOME "EM"
#define RTS "RTS"
#define HEAD "HEAD"
#define TAIL "TAIL"
#define SRC "SOURCE"
#define LIBVAR "LNAME"
#define SUFFIX "SUFFIX"
#define HOME "EM"
#define RTS "RTS"
#define HEAD "HEAD"
#define TAIL "TAIL"
#define SRC "SOURCE"
#define LIBVAR "LNAME"
#define SUFFIX "SUFFIX"
/* Intended for flags, possibly in bit fields */
#define YES 1
#define NO 0
#define MAYBE 2
#define YES 1
#define NO 0
#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 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. */
#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 {
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))
#define p_cont(elem) ((path*)l_content(elem))
/* Own routines */
/* rmach.c */
void setlist(char *);
extern void setlist(char*);
/* svars.c */
void setsvar(char *, char *);
void setpvar(char *, char *(*)(void));
char *getvar(const char *);
extern void setsvar(char*, char*);
extern void setpvar(char*, char* (*)(void));
extern char* getvar(const char*);
/* util.c */
char *ack_basename(const char *);
char *skipblank(char *);
char *firstblank(char *);
void fatal(const char *, ...);
void vprint(const char *, ...);
void fuerror(const char *, ...);
void werror(const char *, ...);
void quit(int);
char *keeps(const char *);
#define throws(str) free(str)
void *getcore(size_t);
void *changecore(void *, size_t);
#define freecore(area) free(area)
extern char* ack_basename(const char*);
extern char* skipblank(char*);
extern char* firstblank(char*);
extern void fatal(const char*, ...);
extern void vprint(const char*, ...);
extern void fuerror(const char*, ...);
extern void werror(const char*, ...);
extern void quit(int);
extern char* keeps(const char*);
#define throws(str) free(str)
extern void* getcore(size_t);
extern void* changecore(void*, size_t);
#define freecore(area) free(area)
#define DEBUG 1 /* Allow debugging of Ack */
#define DEBUG 1 /* Allow debugging of Ack */
#ifndef DEBUG
# define debug 0 /* To surprise all these 'if ( debug ) 's */
#define debug 0 /* To surprise all these 'if ( debug ) 's */
#else
extern int debug ;
extern int debug;
#endif

View file

@ -5,16 +5,48 @@
#include "ack.h"
#include "list.h"
#include "trans.h"
#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
#undef EXTERN
#define EXTERN
#include "data.h"
#ifndef NORCSID
static char rcs_data[] = RCS_DATA ;
char* stopsuffix = NULL; /* Suffix to stop at */
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
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.
* 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 */
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 */
#ifndef DATA_H
#define DATA_H
EXTERN list_head arguments; /* List of arguments */
EXTERN list_head flags; /* List of flags */
extern char* stopsuffix; /* Suffix to stop at */
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 head_list; /* List of suffices for headers */
EXTERN list_head tail_list; /* List of suffices for tails */
extern list_head tr_list; /* List of transformations */
EXTERN int k_flag; /* Like -k of lint */
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 */
extern list_head R_list; /* List of -R flags */
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 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
EXTERN int debug; /* Debugging control */
extern int debug; /* Debugging control */
#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 template[20]; /* The template for temporary file
names */
extern char* outfile; /* The result file e.g. a.out */
extern char template[20]; /* The template for temporary file
names */
EXTERN trf *linker; /* Pointer to the Loader/Linker */
EXTERN trf *cpp_trafo; /* Pointer to C-preprocessor */
extern trf* linker; /* Pointer to the Loader/Linker */
extern trf* cpp_trafo; /* Pointer to C-preprocessor */
EXTERN path in; /* The current single input pathname */
EXTERN path out; /* The current output pathname */
EXTERN path orig; /* The original input path */
EXTERN char *p_basename; /* The current basename */
EXTERN const char *p_suffix; /* The current input suffix */
extern path in; /* The current single input pathname */
extern path out; /* The current output pathname */
extern path orig; /* The original input path */
extern char* p_basename; /* The current basename */
extern const char* p_suffix; /* The current input suffix */
#endif

View file

@ -1,6 +1,8 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
/* machine dependent definitions */
/* the following definitions are for the VAX */
@ -269,17 +271,3 @@ extern short final_state;
extern char *allocate();
extern bucket *lookup();
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 <string.h>
#define DEF_LENGTH 8
@ -184,8 +185,6 @@ char *
Salloc(str)
char *str;
{
char *strcpy();
if (str == 0)
str = "";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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