Merge pull request #259 from davidgiven/dtrg-ci

Make work on Windows.
This commit is contained in:
David Given 2022-07-18 23:05:01 +02:00 committed by GitHub
commit 33ce9169b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
340 changed files with 7739 additions and 34687 deletions

View file

@ -1,17 +0,0 @@
environment:
matrix:
- CYGWIN: C:\cygwin64
clone_depth: 1
init:
- git config --global core.autocrlf input
install:
- '%CYGWIN%\bin\bash -lc "cygcheck -dc cygwin"'
- '%CYGWIN%\setup-x86_64 -q -P bison,flex,ninja'
build_script:
- 'echo building...'
- '%CYGWIN%\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make +ack"'

View file

@ -1,4 +1,4 @@
---
---
AlignAfterOpenBracket: AlwaysBreak
AllowShortFunctionsOnASingleLine: false
AllowShortLoopsOnASingleLine: false

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
* -text

View file

@ -8,50 +8,41 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: apt
run: sudo apt update && sudo apt install bison flex ninja-build lua5.1 lua-posix
run: sudo apt update && sudo apt install bison flex ninja-build lua5.3
- name: make
run: make LUA=lua
run: make
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: brew
run: brew install ninja lua@5.1 luarocks
- name: luarocks
run: |
luarocks install --lua-version 5.1 luaposix 33.0.0-1
run: brew install ninja lua@5.4
- name: make
run: |
eval $(luarocks --lua-version 5.1 path)
make LUA=/usr/local/bin/lua5.1
make
build-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW32
install: >-
make
mingw-w64-i686-gcc
mingw-w64-i686-lua
ninja
bison
flex
zip
git
- uses: actions/checkout@v3
- name: build
run: |
make
# build-windows:
# runs-on: windows-latest
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - uses: msys2/setup-msys2@v2
# with:
# update: true
# msystem: MINGW32
# install: >-
# make
# mingw-w64-i686-gcc
# mingw-w64-x86_64-lua51
# mingw-w64-x86_64-lua-luarocks
# ninja
# bison
# flex
# zip
# git
# - name: luarocks
# run: |
# git config --global url."https://".insteadOf git://
# /mingw64/bin/luarocks --lua-version 5.1 install luaposix 33.0.0-1
# - uses: actions/checkout@v3
# - name: build
# run: |
# make LUA=/mingw64/bin/lua5.1
#

View file

@ -105,7 +105,7 @@ else
$(error unknown BUILDSYSTEM = $(BUILDSYSTEM))
endif
$(build-file): first/ackbuilder.lua Makefile
$(build-file): first/ackbuilder.lua Makefile $(lua-files)
@mkdir -p $(BUILDDIR)
@$(LUA) first/ackbuilder.lua \
first/build.lua build.lua \

5
README
View file

@ -2,7 +2,7 @@
===================================
© 1987-2005 Vrije Universiteit, Amsterdam
2018-02-23
2022-06-18
INTRODUCTION
@ -45,7 +45,8 @@ INSTALLATION
============
The version 5.0 build mechanism has been completely rewritten. Installation
ought to be fairly straightforward.
ought to be fairly straightforward. It will build on Unixishes including Linux,
OSX, and Windows using MSYS2 and mingw32.
Requirements:

View file

@ -28,6 +28,13 @@ vars.plats_with_tests = {
"pc86",
}
local is_windows = os.getenv("OS") == "Windows_NT"
local int = {}
if not is_windows then
int[#int+1] = "util/int+pkg"
end
installable {
name = "ack-common",
map = {
@ -41,10 +48,10 @@ installable {
"util/arch+pkg",
"util/ass+pkg",
"util/ego+pkg",
"util/int+pkg",
"util/led+pkg",
"util/misc+pkg",
"util/opt+pkg",
int
},
}
@ -75,6 +82,7 @@ installable {
},
}
if not is_windows then
normalrule {
name = "tests",
ins = {
@ -88,3 +96,15 @@ normalrule {
"%{ins}"
}
}
else
normalrule {
name = "tests",
ins = {},
outleaves = {
"stamp"
},
commands = {
"touch %{outs}"
}
}
end

View file

@ -7,7 +7,6 @@
-- is = { set of rule types which made the target }
-- }
local posix = require("posix")
local emitter = {}
local rules = {}
local targets = {}
@ -21,6 +20,24 @@ local loadingstack = {}
-- Forward references
local loadtarget
-- Compatibility polyfill for load
local function loadf(text, source, mode, env)
if rawget(_G, "loadstring") and rawget(_G, "setfenv") then
local chunk, e = loadstring(text, "@"..source)
if chunk then
setfenv(chunk, env)
end
return chunk, e
else
return load(text, source, mode, env)
end
end
-- Compatibility polyfill for unpack
if not rawget(_G, "unpack") then
unpack = table.unpack
end
local function print(...)
local function print_no_nl(list)
for _, s in ipairs(list) do
@ -125,7 +142,7 @@ local function concatpath(...)
end
-- Returns a list of the targets within the given collection; the keys of any
-- keyed items are lost. Lists and wildcards are expanded.
-- keyed items are lost. Lists are expanded.
local function targetsof(...)
local o = {}
@ -226,9 +243,6 @@ local function abspath(...)
return dotocollection({...},
function(filename)
assertString(filename, 1)
if not filename:find("^[/$]") then
filename = concatpath(posix.getcwd(), filename)
end
return filename
end
)
@ -345,11 +359,10 @@ local function templateexpand(list, vars)
o[#o+1] = s:gsub("%%%b{}",
function(expr)
expr = expr:sub(3, -2)
local chunk, e = loadstring("return ("..expr..")", expr)
local chunk, e = loadf("return ("..expr..")", expr, nil, vars)
if e then
error(string.format("error evaluating expression: %s", e))
end
setfenv(chunk, vars)
local value = chunk()
if (value == nil) then
error(string.format("template expression '%s' expands to nil (probably an undefined variable)", expr))
@ -381,10 +394,7 @@ local function loadbuildfile(filename)
local thisglobals = {}
thisglobals._G = thisglobals
setmetatable(thisglobals, {__index = globals})
chunk, e = loadstring(data, "@"..filename)
if not e then
setfenv(chunk, thisglobals)
end
chunk, e = loadf(data, filename, nil, thisglobals)
end
end
if e then
@ -401,13 +411,17 @@ end
local function loadbuildfilefor(filepart, targetpart)
local normalname = concatpath(filepart, "/build.lua")
if posix.access(normalname, "r") then
local fp = io.open(normalname, "r")
if fp then
fp:close()
loadbuildfile(normalname)
return
end
local extendedname = concatpath(filepart, "/build-"..targetpart..".lua")
if posix.access(extendedname, "r") then
fp = io.open(extendedname, "r")
if fp then
fp:close()
loadbuildfile(extendedname)
return
end
@ -424,10 +438,7 @@ loadtarget = function(targetname)
if not targetname:find("%+") then
local files
if targetname:find("[?*]") then
files = posix.glob(targetname)
if not files then
files = {}
end
error("wildcards not supported")
else
files = {targetname}
end
@ -823,8 +834,6 @@ local function parse_arguments(argmap, arg)
end
globals = {
posix = posix,
abspath = abspath,
asstring = asstring,
basename = basename,

View file

@ -1,10 +1,10 @@
definerule("yacc",
definerule("bison",
{
srcs = { type="targets" },
commands = {
type="strings",
default={
"yacc -t -b %{dir}/y -d %{ins}"
"bison -t -b %{dir}/y -d %{ins}"
}
},
},

View file

@ -23,7 +23,23 @@ normalrule {
clibrary {
name = "emheaders",
hdrs = {
"./*.h",
"./arch.h",
"./as_spec.h",
"./cgg_cg.h",
"./cg_pattern.h",
"./em_abs.h",
"./em_ego.h",
"./em_flag.h",
"./em_mes.h",
"./em_ptyp.h",
"./em_reg.h",
"./ip_spec.h",
"./ocm_chan.h",
"./ocm_parco.h",
"./ocm_proc.h",
"./out.h",
"./ranlib.h",
"./stb.h",
"./con_float",
"+em_path",
"+local",

88
h/em_table_lib.lua Normal file
View file

@ -0,0 +1,88 @@
local function strip(s)
return s:match("^%s*(.-)%s*$")
end
function load_table()
local specs = {}
for line in io.lines() do
line = strip(line)
if line == "" then
break
end
local _, _, name, num = line:find("^(%w+)%s+(%d+)$")
if not name then
error("malformed spec line in em_table")
end
specs[#specs+1] = {
name = name,
num = tonumber(num)
}
end
for _, v in ipairs(specs) do
specs[v.name] = v
end
local pseudos = {}
local pseudo_count = 0
for line in io.lines() do
line = strip(line)
if line == "" then
break
end
local _, _, name, num, flags = line:find("^(%w+)%s+(%d+)%s+(%g+)$")
if not name then
error("malformed pseudo line in em_table")
end
pseudos[#pseudos+1] = {
name = name,
num = tonumber(num) + specs.fpseu.num,
flags = flags
}
pseudo_count = pseudo_count + 1
end
local mnems = {}
local mnem_count = 0
for line in io.lines() do
line = strip(line)
if line == "" then
break
end
local _, _, name, flags1, flags2 = line:find("^(%w+)%s+(%g+)%s+(%g+)$")
if not name then
error("malformed mnemonic line in em_table")
end
mnem_count = mnem_count + 1
mnems[#mnems+1] = {
name = name,
num = mnem_count,
flags1 = flags1,
flags2 = flags2
}
end
local lpseu = {
name = "lpseu",
num = specs.fpseu.num + pseudo_count - 1
}
local lmnem = {
name = "lmnem",
num = specs.fmnem.num + mnem_count - 1
}
specs[#specs+1] = lpseu
specs.lpseu = lpseu
specs[#specs+1] = lmnem
specs.lmnem = lmnem
return specs, pseudos, mnems
end

View file

@ -93,13 +93,13 @@ int narg;
postin[0] = dup(0);
if (pass1) {
if (useroif) {
if ((hashin = fopen(oifile, "r")) == NULL)
if ((hashin = fopen(oifile, "rb")) == NULL)
fatal("bad ignore/only file: %s",oifile);
buildhash();
fclose(hashin);
}
input = stdin;
output = fdopen(scanout[1], "w");
output = fdopen(scanout[1], "wb");
nfiles = argc;
setjmp(env);
while (argc--)
@ -203,9 +203,9 @@ scan(s) char *s;
oifsuf++;
if (lastc != oifile[oifsuf] ) {
oifile[oifsuf] = lastc;
if ((hashin = fopen(oifile, "r")) == NULL) {
if ((hashin = fopen(oifile, "rb")) == NULL) {
oifile[oifsuf] = 'x';
if ((hashin = fopen(oifile, "r")) == NULL)
if ((hashin = fopen(oifile, "rb")) == NULL)
fatal("cannot open %s",oifile);
}
buildhash();
@ -215,7 +215,7 @@ scan(s) char *s;
if (s[0]=='-' && s[1]=='\0')
input = stdin;
else
if ((input = fopen(s, "r")) == NULL)
if ((input = fopen(s, "rb")) == NULL)
fatal("cannot open %s",s);
switch (type) {
case 'x':

View file

@ -45,7 +45,7 @@ extern const char* modulename;
extern int paramsize;
extern struct hshtab hshtab[HSHSIZ];
extern int hshused;
extern int eof;
extern int ateof;
extern int peekc;
extern const char* ctab;
extern struct hshtab *bsym;

View file

@ -22,7 +22,7 @@ int string_part;
int paramsize;
struct hshtab hshtab[HSHSIZ];
int hshused;
int eof;
int ateof;
int peekc;
const char* ctab;
struct hshtab *bsym;
@ -129,7 +129,7 @@ main(int argc, char *argv[])
string_part = 0;
code_part = C_getid();
C_beginpart(code_part);
while (!eof) {
while (!ateof) {
extdef();
blkend();
}
@ -368,12 +368,12 @@ symbol(void)
c = peekc;
peekc = 0;
} else
if (eof)
if (ateof)
return EOFC;
else
c = getchar();
if (c==EOF) {
eof++;
ateof++;
return(EOFC);
}
@ -453,7 +453,7 @@ loop:
}
}
}
eof++;
ateof++;
error("Nonterminated comment");
return EOFC;
@ -820,7 +820,7 @@ stmt:
if ((o = symbol()) == LBRACE) {
if (d)
blkhed();
while (!eof) {
while (!ateof) {
if ((o = symbol()) == RBRACE)
goto bend;
pushsym(o);

View file

@ -2,10 +2,11 @@
cprogram {
name = "em_b",
srcs = {
"./*.c",
"./b0.c",
"./b1.c",
},
deps = {
"./*.h",
"./b.h",
"modules+headers",
"modules/src/alloc+lib",
"modules/src/data+lib",

View file

@ -4,12 +4,12 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.c",
"./*.e",
"./init.c",
"./main.c",
},
hdrs = {}, -- must be empty
deps = {
"./*.h",
"./b.h",
"h+emheaders",
"lang/cem/libcc.ansi/headers+pkg",
"plat/"..plat.."/include+pkg",

View file

@ -4,15 +4,47 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.c",
"./*.e",
"./abs.c",
"./asc.c",
"./asrt.c",
"./atn.c",
"./chr.c",
"./conversion.c",
"./error.c",
"./exp.c",
"./file.c",
"./hlt.c",
"./io.c",
"./log.c",
"./mki.c",
"./oct.c",
"./peek.c",
"./power.c",
"./print.c",
"./random.c",
"./read.c",
"./return.c",
"./salloc.c",
"./sgn.c",
"./sin.c",
"./sqt.c",
"./stop.c",
"./string.c",
"./swap.c",
"./trace.c",
"./trap.c",
"./write.c",
"./fef.e",
"./fif.e",
"./setline.e",
},
hdrs = {}, -- must be empty
deps = {
"h+emheaders",
"lang/cem/libcc.ansi/headers+pkg",
"plat/"..plat.."/include+pkg",
"./*.h",
"./bc_io.h",
"./lib.h",
},
vars = { plat = plat }
}

View file

@ -76,19 +76,19 @@ void _opnchn(int reclen, String* fname, String* mode)
{
case 'O':
case 'o':
if ((f = fopen(fname->strval, "w")) == NULL)
if ((f = fopen(fname->strval, "wb")) == NULL)
error(28);
m = OMODE;
break;
case 'I':
case 'i':
if ((f = fopen(fname->strval, "r")) == NULL)
if ((f = fopen(fname->strval, "rb")) == NULL)
error(28);
m = IMODE;
break;
case 'r':
case 'R':
if ((f = fopen(fname->strval, "a")) == NULL)
if ((f = fopen(fname->strval, "ab")) == NULL)
error(28);
m = RMODE;
break;

View file

@ -572,6 +572,7 @@ int yylex(void)
/* handle double operators */
case ' ':
case '\t':
case '\r':
cptr++;
return(yylex());
case '&':

View file

@ -2,30 +2,48 @@ include("util/LLgen/build.lua")
llgen {
name = "llgen",
srcs = { "./*.g" }
srcs = { "./basic.g" }
}
normalrule {
name = "tokentab_h",
ins = {
"./maketokentab",
"util/cmisc+ed",
matching(filenamesof("+llgen"), "/Lpars.h$"),
},
outleaves = { "tokentab.h" },
commands = {
"%{ins} %{outs}"
"%{ins[1]} < %{ins[2]} > %{outs}"
}
}
cprogram {
name = "em_bem",
srcs = {
"./*.c",
"./bem.c",
"./compile.c",
"./eval.c",
"./func.c",
"./gencode.c",
"./graph.c",
"./initialize.c",
"./parsepar.c",
"./symbols.c",
"./util.c",
matching(filenamesof("+llgen"), "%.c$"),
},
deps = {
"./*.h",
"./bem.h",
"./eval.h",
"./func.h",
"./gencode.h",
"./graph.h",
"./llmess.h",
"./parsepar.h",
"./symbols.h",
"./util.h",
"./yylexp.h",
"./basic.lex",
"+llgen",
"+tokentab_h",
"h+emheaders",

View file

@ -1,17 +1,6 @@
#!/bin/sh
$1 -s "${2:-Lpars.h}" > $3 <<'+'
1d
1,$s/# *define //
1,$s/ ...$//
1,$s/^/ "/
1,$-1s/$/",/
$s/$/"/
0a
char *tokentab[] = {
.
$a
};
.
1,$p
+
echo "char* tokentab[] = {"
awk '/^#define/ { print "\"" $2 "\"," }'
echo "};"

View file

@ -13,11 +13,34 @@ normalrule {
}
}
local str_files = basename(filenamesof("./*.str"))
local str_files = {
"./code.str",
"./declar.str",
"./def.str",
"./estack.str",
"./expr.str",
"./field.str",
"./idf.str",
"./l_brace.str",
"./l_outdef.str",
"./l_state.str",
"./macro.str",
"./next.str",
"./proto.str",
"./stack.str",
"./stmt.str",
"./struct.str",
"./switch.str",
"./type.str",
"./util.str"
}
local str_bases = basename(filenamesof(str_files))
local str_targets = {}
for _, f in ipairs(str_files) do
local bf = f:gsub("%.str$", "")
for _, f in ipairs(str_bases) do
local bf = f:gsub("%.str$", ""):gsub("^$./", "")
str_targets[#str_targets+1] = normalrule {
name = "allocd_header/"..bf,
ins = { "./make.allocd", "./"..f },
@ -32,7 +55,7 @@ normalrule {
name = "next-c",
ins = {
"./make.next",
"./*.str",
str_files
},
outleaves = { "next.c" },
commands = {
@ -78,7 +101,11 @@ llgen {
name = "llgen",
srcs = {
"+tokenfile-g", -- must be first
"./*.g",
"./declar.g",
"./expression.g",
"./ival.g",
"./program.g",
"./statement.g",
},
}

View file

@ -58,7 +58,8 @@ normalrule {
name = "next_c",
ins = {
"./make.next",
"./*.str",
"./macro.str",
"./replace.str",
},
outleaves = { "next.c" },
commands = {
@ -82,7 +83,22 @@ tabgen {
cprogram {
name = "cpp",
srcs = concat(
"./*.c",
"./ch3bin.c",
"./ch3mon.c",
"./domacro.c",
"./error.c",
"./expr.c",
"./idf.c",
"./init.c",
"./input.c",
"./LLlex.c",
"./LLmessage.c",
"./main.c",
"./options.c",
"./preprocess.c",
"./replace.c",
"./skip.c",
"./tokenname.c",
matching(filenamesof(llgen), "%.c$"),
"+next_c",
"+symbol2str_c",

View file

@ -33,24 +33,163 @@ for _, plat in ipairs(vars.plats) do
srcs = {
"+ctype_files",
"+ctype_tab",
"./core/ctype/*.c",
"./core/errno/*.c",
"./core/locale/*.c",
"./core/math/*.c",
"./core/math/*.e",
"./core/misc/*.c",
"./core/printf/*.c",
"./core/scanf/*.c",
"./core/setjmp/*.c",
"./core/setjmp/*.e",
"./core/stdlib/*.c",
"./core/stdio/*.c",
"./core/string/*.c",
"./core/time/*.c",
"./sys/exit/*.c",
"./sys/malloc/*.c",
"./sys/misc/*.c",
"./sys/stdio/*.c",
"./core/ctype/tolower.c",
"./core/ctype/toupper.c",
"./core/errno/errlist.c",
"./core/errno/perror.c",
"./core/errno/strerror.c",
"./core/locale/localeconv.c",
"./core/locale/setlocale.c",
"./core/math/asin.c",
"./core/math/atan2.c",
"./core/math/atan.c",
"./core/math/ceil.c",
"./core/math/exp.c",
"./core/math/fabs.c",
"./core/math/floor.c",
"./core/math/fmod.c",
"./core/math/frexp.e",
"./core/math/hugeval.c",
"./core/math/hypot.c",
"./core/math/isnan.c",
"./core/math/ldexp.c",
"./core/math/log10.c",
"./core/math/log.c",
"./core/math/modf.e",
"./core/math/pow.c",
"./core/math/sin.c",
"./core/math/sinh.c",
"./core/math/sqrt.c",
"./core/math/tan.c",
"./core/math/tanh.c",
"./core/misc/abort.c",
"./core/misc/assert.c",
"./core/misc/getopt.c",
"./core/misc/raise.c",
"./core/misc/termcap.c",
"./core/printf/doprnt.c",
"./core/printf/fltpr.c",
"./core/printf/fprintf.c",
"./core/printf/icompute.c",
"./core/printf/itoa.c",
"./core/printf/printf.c",
"./core/printf/snprintf.c",
"./core/printf/sprintf.c",
"./core/printf/vfprintf.c",
"./core/printf/vprintf.c",
"./core/printf/vsnprintf.c",
"./core/printf/vsprintf.c",
"./core/scanf/doscan.c",
"./core/scanf/fscanf.c",
"./core/scanf/scanf.c",
"./core/scanf/sscanf.c",
"./core/scanf/vfscanf.c",
"./core/setjmp/setjmp.e",
"./core/setjmp/sigmisc.c",
"./core/stdio/clearerr.c",
"./core/stdio/feof.c",
"./core/stdio/ferror.c",
"./core/stdio/fgetc.c",
"./core/stdio/fgetpos.c",
"./core/stdio/fgets.c",
"./core/stdio/fputc.c",
"./core/stdio/fputs.c",
"./core/stdio/fread.c",
"./core/stdio/fsetpos.c",
"./core/stdio/fwrite.c",
"./core/stdio/getc.c",
"./core/stdio/getchar.c",
"./core/stdio/gets.c",
"./core/stdio/getw.c",
"./core/stdio/putc.c",
"./core/stdio/putchar.c",
"./core/stdio/puts.c",
"./core/stdio/putw.c",
"./core/stdio/rewind.c",
"./core/stdlib/abs.c",
"./core/stdlib/atof.c",
"./core/stdlib/atoi.c",
"./core/stdlib/atol.c",
"./core/stdlib/bsearch.c",
"./core/stdlib/div.c",
"./core/stdlib/ecvt.c",
"./core/stdlib/environ.c",
"./core/stdlib/ext_comp.c",
"./core/stdlib/getenv.c",
"./core/stdlib/labs.c",
"./core/stdlib/ldiv.c",
"./core/stdlib/mblen.c",
"./core/stdlib/mbstowcs.c",
"./core/stdlib/mbtowc.c",
"./core/stdlib/putenv.c",
"./core/stdlib/qsort.c",
"./core/stdlib/rand.c",
"./core/stdlib/setenv.c",
"./core/stdlib/strtod.c",
"./core/stdlib/strtol.c",
"./core/stdlib/wcstombs.c",
"./core/stdlib/wctomb.c",
"./core/string/memchr.c",
"./core/string/memcmp.c",
"./core/string/memcpy.c",
"./core/string/memmove.c",
"./core/string/memset.c",
"./core/string/strcat.c",
"./core/string/strchr.c",
"./core/string/strcmp.c",
"./core/string/strcoll.c",
"./core/string/strcpy.c",
"./core/string/strcspn.c",
"./core/string/strdup.c",
"./core/string/strlen.c",
"./core/string/strncat.c",
"./core/string/strncmp.c",
"./core/string/strncpy.c",
"./core/string/strpbrk.c",
"./core/string/strrchr.c",
"./core/string/strspn.c",
"./core/string/strstr.c",
"./core/string/strtok.c",
"./core/string/strxfrm.c",
"./core/time/asctime.c",
"./core/time/ctime.c",
"./core/time/difftime.c",
"./core/time/gmtime.c",
"./core/time/localtime.c",
"./core/time/misc.c",
"./core/time/mktime.c",
"./core/time/strftime.c",
"./core/time/tzset.c",
"./sys/exit/atexit.c",
"./sys/exit/exit.c",
"./sys/malloc/calloc.c",
"./sys/malloc/malloc.c",
"./sys/malloc/realloc.c",
"./sys/misc/clock.c",
"./sys/misc/getpass.c",
"./sys/misc/isatty.c",
"./sys/misc/mktemp.c",
"./sys/misc/popen.c",
"./sys/misc/remove.c",
"./sys/misc/sleep.c",
"./sys/misc/system.c",
"./sys/misc/time.c",
"./sys/stdio/data.c",
"./sys/stdio/fclose.c",
"./sys/stdio/fdopen.c",
"./sys/stdio/fflush.c",
"./sys/stdio/fileno.c",
"./sys/stdio/fillbuf.c",
"./sys/stdio/flushbuf.c",
"./sys/stdio/fopen.c",
"./sys/stdio/freopen.c",
"./sys/stdio/fseek.c",
"./sys/stdio/ftell.c",
"./sys/stdio/setbuf.c",
"./sys/stdio/setvbuf.c",
"./sys/stdio/tmpfile.c",
"./sys/stdio/tmpnam.c",
"./sys/stdio/ungetc.c",
},
hdrs = {}, -- must be empty
deps = {

View file

@ -11,9 +11,38 @@ local function addheader(dir, list)
end
end
addheader("", filenamesof("./*.h"))
addheader("sys/", filenamesof("./sys/*.h"))
addheader("ack/", filenamesof("./ack/*.h"))
addheader("", filenamesof(
"./assert.h",
"./ctype.h",
"./errno.h",
"./fcntl.h",
"./float.h",
"./iso646.h",
"./limits.h",
"./locale.h",
"./math.h",
"./setjmp.h",
"./signal.h",
"./stdarg.h",
"./stdbool.h",
"./stddef.h",
"./stdint.h",
"./stdio.h",
"./stdlib.h",
"./string.h",
"./time.h",
"./unistd.h"
))
addheader("sys/", filenamesof(
"./sys/time.h",
"./sys/times.h"
))
addheader("ack/", filenamesof(
"./ack/config.h",
"./ack/emufile.h"
))
acklibrary {
name = "headers",

View file

@ -18,6 +18,7 @@
#include <alloc.h>
#include <em_arith.h>
#include <em_label.h>
#include <stdlib.h>
#include "parameters.h"
#include "idf.h"

View file

@ -15,7 +15,10 @@ llgen {
srcs = {
-- order here is important
"+tokenfile_g",
"./*.g",
"./declar.g",
"./expression.g",
"./program.g",
"./statement.g",
}
}
@ -31,42 +34,10 @@ normalrule {
}
}
for _, f in ipairs(filenamesof("./*.xh")) do
local name = replace(basename(f), "%.xh$", "")
normalrule {
name = name.."_h",
ins = {
"./make.allocd",
f
},
outleaves = { name..".h" },
commands = {
"%{ins[1]} < %{ins[2]} > %{outs}"
}
}
end
for _, f in ipairs(filenamesof("./*.xc")) do
local name = replace(basename(f), "%.xc$", "")
normalrule {
name = name.."_c",
ins = {
"./make.allocd",
f
},
outleaves = { name..".c" },
commands = {
"%{ins[1]} < %{ins[2]} > %{outs}"
}
}
end
normalrule {
name = "next_c",
ins = {
"./make.next",
"./*.xh",
"./*.xc",
},
outleaves = { "next.c" },
commands = {
@ -94,22 +65,39 @@ tabgen {
cprogram {
name = "em_m2",
srcs = {
"./*.c",
"+casestat_c",
"+next_c",
"+scope_c",
"+symbol2str_c",
"+tmpvar_c",
"+chartab_c",
"+next_c",
"+symbol2str_c",
"./LLlex.c",
"./LLmessage.c",
"./casestat.c",
"./chk_expr.c",
"./code.c",
"./cstoper.c",
"./def.c",
"./defmodule.c",
"./desig.c",
"./enter.c",
"./error.c",
"./idf.c",
"./input.c",
"./lookup.c",
"./main.c",
"./misc.c",
"./node.c",
"./options.c",
"./scope.c",
"./stab.c",
"./tmpvar.c",
"./tokenname.c",
"./type.c",
"./typequiv.c",
"./walk.c",
matching(filenamesof("+llgen"), "%.c$"),
},
deps = {
"+def_h",
"+llgen",
"+node_h",
"+parameters_h",
"+real_h",
"+type_h",
"h+emheaders",
"lang/m2/include+headers",
"modules+headers",

View file

@ -19,6 +19,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include "em_label.h"
#include "em_arith.h"
@ -50,7 +51,8 @@ struct switch_hdr {
*/
};
/* STATICALLOCDEF "switch_hdr" 5 */
#define new_switch_hdr() ((struct switch_hdr*) calloc(1, sizeof(struct switch_hdr)))
#define free_switch_hdr(p) free(p)
struct case_entry {
struct case_entry *ce_next; /* next in list */
@ -60,7 +62,8 @@ struct case_entry {
/* STATICALLOCDEF "case_entry" 20 */
#define new_case_entry() ((struct case_entry*) calloc(1, sizeof(struct case_entry)))
#define free_case_entry(p) free(p)

View file

@ -15,6 +15,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include "em_arith.h"
#include "em_label.h"

View file

@ -132,7 +132,8 @@ struct def { /* list of definitions for a name */
};
/* ALLOCDEF "def" 50 */
#define new_def() ((struct def*) calloc(1, sizeof(struct def)))
#define free_def(p) free(p)
#define NULLDEF ((struct def *) 0)

View file

@ -19,6 +19,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include "em_arith.h"
#include "em_label.h"

View file

@ -23,6 +23,7 @@
#include <varargs.h>
#endif
#include <stdlib.h>
#include <system.h>
#include <em_arith.h>
#include <em_label.h>

View file

@ -15,6 +15,7 @@
#include <em_arith.h>
#include <em_label.h>
#include <assert.h>
#include <stdlib.h>
#include "lookup.h"
#include "LLlex.h"

View file

@ -13,6 +13,7 @@
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include "system.h"
#include "em_arith.h"
#include "em_label.h"

View file

@ -1,28 +0,0 @@
#!/bin/sh
sed -e '
s:^.*[ ]ALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\
/* allocation definitions of struct \1 */\
extern char *st_alloc();\
extern struct \1 *h_\1;\
#ifdef DEBUG\
extern int cnt_\1;\
extern char *std_alloc();\
#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
#else\
#define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
#endif\
#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
:' -e '
s:^.*[ ]STATICALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\
/* allocation definitions of struct \1 */\
extern char *st_alloc();\
struct \1 *h_\1;\
#ifdef DEBUG\
int cnt_\1;\
#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
#else\
#define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
#endif\
#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
:'

View file

@ -1,35 +0,0 @@
#!/bin/sh
: Update Files from database
PATH=/bin:/usr/bin
case $# in
1) ;;
*) echo use: $0 file >&2
exit 1
esac
(
IFCOMMAND="if [ -r \$FN ] ;\
then if cmp -s \$FN \$TMP;\
then rm \$TMP;\
else mv \$TMP \$FN;\
echo update \$FN;\
fi;\
else mv \$TMP \$FN;\
echo create \$FN;\
fi"
echo 'TMP=.uf$$'
echo 'FN=$TMP'
echo 'cat >$TMP <<\!EOF!'
sed -n '/^!File:/,${
/^$/d
/^!File:[ ]*\(.*\)$/s@@!EOF!\
'"$IFCOMMAND"'\
FN=\1\
cat >$TMP <<\\!EOF!@
p
}' $1
echo '!EOF!'
echo $IFCOMMAND
) | eval "$(cat)"

View file

@ -16,6 +16,7 @@
#include <em_arith.h>
#include <alloc.h>
#include <system.h>
#include <stdlib.h>
#include "LLlex.h"
#include "def.h"

View file

@ -52,9 +52,8 @@ struct node {
#define nd_RVAL nd_token.TOK_RVAL
};
/* ALLOCDEF "node" 50 */
#define new_node() ((struct node*) calloc(1, sizeof(struct node)))
#define free_node(p) free(p)
extern struct node *dot2node(), *dot2leaf(), *getnode();

View file

@ -14,6 +14,7 @@
#include <em_arith.h>
#include <em_label.h>
#include <alloc.h>
#include <stdlib.h>
#include "type.h"
#include "main.h"

View file

@ -1,158 +0,0 @@
# $Id$
# make Modula-2 compiler
#PARAMS do not remove this line!
UTIL_BIN = \
$(UTIL_HOME)/bin
SRC_DIR = \
$(SRC_HOME)/lang/m2/comp
TABGEN= $(UTIL_BIN)/tabgen
LLGEN = $(UTIL_BIN)/LLgen
LLGENOPTIONS = \
-n
SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
$(SRC_DIR)/expression.g $(SRC_DIR)/statement.g
GEN_G = tokenfile.g
GFILES= $(GEN_G) $(SRC_G)
SRC_C = $(SRC_DIR)/LLlex.c $(SRC_DIR)/LLmessage.c $(SRC_DIR)/error.c \
$(SRC_DIR)/main.c $(SRC_DIR)/tokenname.c $(SRC_DIR)/idf.c \
$(SRC_DIR)/input.c $(SRC_DIR)/type.c $(SRC_DIR)/def.c \
$(SRC_DIR)/misc.c $(SRC_DIR)/enter.c $(SRC_DIR)/defmodule.c \
$(SRC_DIR)/typequiv.c $(SRC_DIR)/node.c $(SRC_DIR)/cstoper.c \
$(SRC_DIR)/chk_expr.c $(SRC_DIR)/options.c $(SRC_DIR)/walk.c \
$(SRC_DIR)/desig.c $(SRC_DIR)/code.c $(SRC_DIR)/lookup.c \
$(SRC_DIR)/stab.c
GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
symbol2str.c char.c Lpars.c Lncor.c casestat.c tmpvar.c scope.c next.c
CFILES= $(SRC_C) $(GEN_C)
SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/chk_expr.h $(SRC_DIR)/class.h \
$(SRC_DIR)/debug.h $(SRC_DIR)/desig.h $(SRC_DIR)/f_info.h \
$(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
$(SRC_DIR)/misc.h $(SRC_DIR)/scope.h $(SRC_DIR)/standards.h \
$(SRC_DIR)/tokenname.h $(SRC_DIR)/walk.h $(SRC_DIR)/warning.h \
$(SRC_DIR)/SYSTEM.h
GEN_H = errout.h idfsize.h numsize.h strsize.h target_sizes.h bigresult.h \
inputtype.h density.h squeeze.h nocross.h nostrict.h def.h debugcst.h \
type.h Lpars.h node.h strict3rd.h real.h use_insert.h dbsymtab.h \
uns_arith.h def.h type.h node.h real.h
HFILES= $(GEN_H) $(SRC_H)
NEXTFILES = \
$(SRC_DIR)/def.H $(SRC_DIR)/type.H $(SRC_DIR)/node.H $(SRC_DIR)/real.H \
$(SRC_DIR)/scope.C $(SRC_DIR)/tmpvar.C $(SRC_DIR)/casestat.C
all: make.main
make -f make.main main
install: all
cp main $(TARGET_HOME)/lib.bin/em_m2
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/em_m2.6 $(TARGET_HOME) ; \
mk_manpage $(SRC_DIR)/modula-2.1 $(TARGET_HOME) ; \
fi
cmp: all
-cmp main $(TARGET_HOME)/lib.bin/em_m2
opr:
make pr | opr
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
$(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
lint: make.main
make -f make.main lint
Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
echo $(CFILES) | tr ' ' '\012' > Cfiles
echo $(HFILES) | tr ' ' '\012' >> Cfiles
resolved: Cfiles
CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
-if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
touch resolved
# there is no file called "dependencies"; we want dependencies checked
# every time. This means that make.main is made every time. Oh well ...
# it does not take much time.
dependencies: resolved
do_deps `grep '.c$$' Cfiles`
make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
cat *.dep >> make.main
make_macros: Makefile
echo 'SRC_DIR=$(SRC_DIR)' > make_macros
echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
echo 'CC=$(CC)' >> make_macros
echo 'COPTIONS=$(COPTIONS)' >> make_macros
echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
echo 'LINT=$(LINT)' >> make_macros
echo 'LINTSUF=$(LINTSUF)' >> make_macros
echo 'LINTPREF=$(LINTPREF)' >> make_macros
echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
echo 'SUF=$(SUF)' >> make_macros
echo 'LIBSUF=$(LIBSUF)' >> make_macros
echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
lists: Cfiles
echo "C_SRC = \\" > lists
echo $(CFILES) >> lists
echo "OBJ = \\" >> lists
echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
clean:
-make -f make.main clean
rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
rm -f resolved *.dep lists make.main make_macros
LLfiles: $(GFILES)
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
@touch LLfiles
@if [ -f Lncor.c ] ; then : ; else touch Lncor.c ; fi
hfiles: Parameters $(SRC_DIR)/make.hfiles
$(SRC_DIR)/make.hfiles Parameters
touch hfiles
tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
$(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
$(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
def.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/def.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/def.H > def.h
type.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/type.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/type.H > type.h
real.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/real.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/real.H > real.h
node.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/node.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/node.H > node.h
scope.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/scope.C
$(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.C > scope.c
tmpvar.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/tmpvar.C
$(SRC_DIR)/make.allocd < $(SRC_DIR)/tmpvar.C > tmpvar.c
casestat.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/casestat.C
$(SRC_DIR)/make.allocd < $(SRC_DIR)/casestat.C > casestat.c
next.c: $(NEXTFILES) $(SRC_DIR)/make.next
$(SRC_DIR)/make.next $(NEXTFILES) > next.c
char.c: $(SRC_DIR)/char.tab
$(TABGEN) -f$(SRC_DIR)/char.tab >char.c

View file

@ -16,4 +16,5 @@ struct real {
flt_arith r_val;
};
/* ALLOCDEF "real" 20 */
#define new_real() ((struct real*) calloc(1, sizeof(struct real)))
#define free_real(p) free(p)

View file

@ -12,6 +12,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include "alloc.h"
#include "em_arith.h"
@ -31,9 +32,11 @@ struct scopelist *CurrVis, *GlobalVis;
extern int proclevel;
extern char options[];
/* STATICALLOCDEF "scope" 10 */
#define new_scope() ((struct scope*) calloc(1, sizeof(struct scope)))
#define free_scope(p) free(p)
/* STATICALLOCDEF "scopelist" 10 */
#define new_scopelist() ((struct scopelist*) calloc(1, sizeof(struct scopelist)))
#define free_scopelist(p) free(p)
static int sc_count;

View file

@ -25,6 +25,7 @@
#include <em_reg.h>
#include <alloc.h>
#include <assert.h>
#include <stdlib.h>
#include "LLlex.h"
#include "def.h"
@ -32,13 +33,15 @@
#include "scope.h"
#include "tmpvar.h"
#include "main.h"
#include "tmpvar.h"
struct tmpvar {
struct tmpvar *t_next;
arith t_offset; /* offset from LocalBase */
};
/* STATICALLOCDEF "tmpvar" 10 */
#define new_tmpvar() ((struct tmpvar*) calloc(1, sizeof(struct tmpvar)))
#define free_tmpvar(p) free(p)
static struct tmpvar *TmpInts, /* for integer temporaries */
*TmpPtrs; /* for pointer temporaries */

View file

@ -9,6 +9,7 @@
/* $Id$ */
#include <stdlib.h>
#include "parameters.h"
#include "tokenname.h"
#include "Lpars.h"

View file

@ -12,6 +12,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include <ack_string.h>
#include <alloc.h>

View file

@ -24,8 +24,8 @@ struct paramlist { /* structure for parameterlist of a PROCEDURE */
};
struct paramlist;
/* ALLOCDEF "paramlist" 20 */
#define new_paramlist() ((struct paramlist*) calloc(1, sizeof(struct paramlist)))
#define free_paramlist(p) free(p)
struct enume {
struct def *en_enums; /* Definitions of enumeration literals */
@ -36,7 +36,8 @@ struct enume {
#define enm_rck tp_value.tp_enum->en_rck
};
/* ALLOCDEF "enume" 5 */
#define new_enume() ((struct enume*) calloc(1, sizeof(struct enume)))
#define free_enume(p) free(p)
struct subrange {
arith su_lb, su_ub; /* lower bound and upper bound */
@ -46,7 +47,8 @@ struct subrange {
#define sub_rck tp_value.tp_subrange->su_rck
};
/* ALLOCDEF "subrange" 5 */
#define new_subrange() ((struct subrange*) calloc(1, sizeof(struct subrange)))
#define free_subrange(p) free(p)
struct array {
struct type *ar_elem; /* type of elements */
@ -61,7 +63,8 @@ struct array {
#define arr_high tp_value.tp_arr->ar_high
};
/* ALLOCDEF "array" 5 */
#define new_array() ((struct array*) calloc(1, sizeof(struct array)))
#define free_array(p) free(p)
struct record {
struct scope *rc_scope; /* scope of this record */
@ -126,7 +129,8 @@ struct type {
struct type;
/* ALLOCDEF "type" 50 */
#define new_type() ((struct type*) calloc(1, sizeof(struct type)))
#define free_type(p) free(p)
extern struct type
*bool_type,

View file

@ -15,6 +15,7 @@
#include "parameters.h"
#include "debug.h"
#include <stdlib.h>
#include <em_arith.h>
#include <em_label.h>
#include <assert.h>

View file

@ -1,4 +1,7 @@
clibrary {
name = "headers",
hdrs = {"./*.h"}
hdrs = {
"./libm2.h",
"./m2_traps.h",
}
}

View file

@ -9,7 +9,34 @@ local function addheader(dir, list)
end
end
addheader("", filenamesof("./*.def"))
addheader("", filenamesof(
"./Arguments.def",
"./ArraySort.def",
"./ASCII.def",
"./Conversions.def",
"./CSP.def",
"./EM.def",
"./Epilogue.def",
"./InOut.def",
"./MathLib0.def",
"./Mathlib.def",
"./PascalIO.def",
"./Processes.def",
"./random.def",
"./RealConversions.def",
"./RealInOut.def",
"./Semaphores.def",
"./Storage.def",
"./Streams.def",
"./Strings.def",
"./StripUnix.def",
"./Termcap.def",
"./Terminal.def",
"./Traps.def",
"./Unix.def",
"./XXTermcap.def"
))
installable {
name = "headers",
@ -20,8 +47,47 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.c",
"./*.mod",
"./absd.c",
"./absi.c",
"./absl.c",
"./Arguments.c",
"./ArraySort.mod",
"./blockmove.c",
"./cap.c",
"./catch.c",
"./confarray.c",
"./Conversions.mod",
"./CSP.mod",
"./dvi.c",
"./halt.c",
"./init.c",
"./InOut.mod",
"./load.c",
"./MathLib0.mod",
"./Mathlib.mod",
"./PascalIO.mod",
"./Processes.mod",
"./random.mod",
"./rcka.c",
"./rcki.c",
"./rckil.c",
"./rcku.c",
"./rckul.c",
"./RealConversions.mod",
"./RealInOut.mod",
"./Semaphores.mod",
"./sigtrp.c",
"./stackprio.c",
"./Storage.mod",
"./store.c",
"./StrAss.c",
"./Streams.mod",
"./Strings.mod",
"./SYSTEM.c",
"./Termcap.mod",
"./Terminal.mod",
"./Traps.mod",
"./ucheck.c",
"./EM.e",
"./LtoUset.e",
"./absf.e",

View file

@ -15,7 +15,10 @@ llgen {
srcs = {
-- order here is important
"+tokenfile_g",
"./*.g",
"./declar.g",
"./expression.g",
"./program.g",
"./statement.g",
}
}
@ -31,7 +34,15 @@ normalrule {
}
}
for _, f in ipairs(filenamesof("./*.xh")) do
local xh_files = {
"./def.xh",
"./desig.xh",
"./node.xh",
"./scope.xh",
"./type.xh",
}
for _, f in ipairs(filenamesof(xh_files)) do
local name = replace(basename(f), "%.xh$", "")
normalrule {
name = name.."_h",
@ -46,7 +57,12 @@ for _, f in ipairs(filenamesof("./*.xh")) do
}
end
for _, f in ipairs(filenamesof("./*.xc")) do
local xc_files = {
"./casestat.xc",
"./tmpvar.xc",
}
for _, f in ipairs(filenamesof(xc_files)) do
local name = replace(basename(f), "%.xc$", "")
normalrule {
name = name.."_c",
@ -65,8 +81,8 @@ normalrule {
name = "next_c",
ins = {
"./make.next",
"./*.xh",
"./*.xc",
xh_files,
xc_files
},
outleaves = { "next.c" },
commands = {
@ -94,7 +110,31 @@ tabgen {
cprogram {
name = "em_pc",
srcs = {
"./*.c",
"./body.c",
"./chk_expr.c",
"./code.c",
"./cstoper.c",
"./def.c",
"./desig.c",
"./enter.c",
"./error.c",
"./idf.c",
"./input.c",
"./label.c",
"./LLlex.c",
"./LLmessage.c",
"./lookup.c",
"./main.c",
"./misc.c",
"./node.c",
"./options.c",
"./progs.c",
"./readwrite.c",
"./scope.c",
"./stab.c",
"./tokenname.c",
"./type.c",
"./typequiv.c",
"+casestat_c",
"+chartab_c",
"+next_c",

View file

@ -1,4 +1,9 @@
clibrary {
name = "headers",
hdrs = {"./*.h"}
hdrs = {
"./pc_err.h",
"./pc_file.h",
"./pc.h",
"./pc_math.h",
}
}

View file

@ -4,7 +4,66 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.c",
"./abi.c",
"./abl.c",
"./abr.c",
"./arg.c",
"./ass.c",
"./asz.c",
"./atn.c",
"./bcp.c",
"./buff.c",
"./catch.c",
"./cls.c",
"./cvt.c",
"./diag.c",
"./efl.c",
"./eln.c",
"./exp.c",
"./get.c",
"./hlt.c",
"./incpt.c",
"./ini.c",
"./log.c",
"./mdi.c",
"./mdl.c",
"./new.c",
"./nfa.c",
"./nobuff.c",
"./notext.c",
"./opn.c",
"./outcpt.c",
"./pac.c",
"./pclose.c",
"./pcreat.c",
"./pentry.c",
"./perrno.c",
"./pexit.c",
"./popen.c",
"./put.c",
"./rcka.c",
"./rdc.c",
"./rdi.c",
"./rdl.c",
"./rdr.c",
"./rf.c",
"./rln.c",
"./rnd.c",
"./sin.c",
"./sqt.c",
"./string.c",
"./unp.c",
"./uread.c",
"./uwrite.c",
"./wdw.c",
"./wf.c",
"./wrc.c",
"./wrf.c",
"./wri.c",
"./wrl.c",
"./wrr.c",
"./wrs.c",
"./wrz.c",
"./bts.e",
"./encaps.e",
"./fef.e",

View file

@ -93,12 +93,12 @@ main(argc, argv)
}
switch (argc) {
case 1: break;
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
ofile = argv[2];
ofile_created = 1;
/* FALLTHROUGH */
case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0)
case 2: if ((input = fopen(argv[1], "rb")) == (FILE *)0)
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <ack object> <riscos object>.\n", argv[0]);

View file

@ -1,7 +1,7 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.e" },
srcs = { "./dummy.e", },
vars = { plat = plat },
}
end

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.e" },
srcs = {
"./edata.e",
"./em_end.e",
"./end.e",
"./etext.e",
},
vars = { plat = plat },
}
end

12
mach/i386/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -1,7 +1,59 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" }, -- csb8.s
srcs = {
"./adi.s",
"./and.s",
"./blm.s",
"./cii.s",
"./cms.s",
"./com.s",
"./csa4.s",
"./csa8.s",
"./csb4.s",
"./csb8.s",
"./cuu.s",
"./divrem8.s",
"./dup.s",
"./dvi8.s",
"./dvi.s",
"./dvu8.s",
"./dvu.s",
"./error.s",
"./exg.s",
"./fat.s",
"./fp8087.s",
"./gto.s",
"./iaar.s",
"./ilar.s",
"./inn.s",
"./ior.s",
"./isar.s",
"./lar4.s",
"./loi.s",
"./mli8.s",
"./mli.s",
"./mon.s",
"./ngi.s",
"./nop.s",
"./print.s",
"./rck.s",
"./rmi8.s",
"./rmi.s",
"./rmu.s",
"./rol.s",
"./ror.s",
"./sar4.s",
"./sbi.s",
"./set.s",
"./sli.s",
"./sri.s",
"./sti.s",
"./strhp.s",
"./trp.s",
"./unknown.s",
"./xor.s",
},
vars = { plat = plat },
}
end

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

8
mach/i386/ncg/build.lua Normal file
View file

@ -0,0 +1,8 @@
bundle {
name = "headers",
srcs = {
"./mach.c",
"./mach.h"
}
}

12
mach/i80/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -58,7 +58,52 @@ end
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = concat("./*.s", generated),
srcs = {
"./aar2.s",
"./adi4.s",
"./and.s",
"./blm.s",
"./cii.s",
"./cmi4.s",
"./cmps_mag.s",
"./cmpu_mag.s",
"./cms.s",
"./com.s",
"./csa.s",
"./csb.s",
"./dup.s",
"./dvi2.s",
"./dvi4.s",
"./exg.s",
"./flp.s",
"./inn.s",
"./ior.s",
"./lar2.s",
"./loi.s",
"./mli2.s",
"./mli4.s",
"./mlu2.s",
"./ngi4.s",
"./nop.s",
"./pchl.s",
"./pro.s",
"./rck.s",
"./ret.s",
"./rol4.s",
"./ror4.s",
"./rst.s",
"./sar2.s",
"./sbi4.s",
"./set2.s",
"./set.s",
"./sli2.s",
"./sli4.s",
"./sri2.s",
"./sri4.s",
"./sti.s",
"./xor.s",
generated
},
vars = {
plat = plat,
["+ackcflags"] = {"-Imach/i80/libem"}

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

8
mach/i80/ncg/build.lua Normal file
View file

@ -0,0 +1,8 @@
bundle {
name = "headers",
srcs = {
"./mach.c",
"./mach.h"
}
}

12
mach/i86/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -102,7 +102,7 @@ main(argc, argv)
switch (argc) {
case 1: rd_fdopen(0);
break;
case 3: if ((output = fopen(argv[2], "w")) == 0) {
case 3: if ((output = fopen(argv[2], "wb")) == 0) {
fatal("Can't write %s.\n", argv[2]);
}
output_file = argv[2];

View file

@ -1,7 +1,67 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./adi.s",
"./and.s",
"./blm.s",
"./cii.s",
"./cmi4.s",
"./cms.s",
"./cmu4.s",
"./com.s",
"./csa2.s",
"./csa4.s",
"./csb2.s",
"./csb4.s",
"./cuu.s",
"./dup.s",
"./dvi4.s",
"./dvi.s",
"./dvu4.s",
"./dvu.s",
"./error.s",
"./exg.s",
"./fat.s",
"./fp8087.s",
"./gto.s",
"./iaar.s",
"./ilar.s",
"./inn.s",
"./ior.s",
"./isar.s",
"./lar2.s",
"./lfr6.s",
"./lfr8.s",
"./loi.s",
"./mli4.s",
"./mli.s",
"./mon.s",
"./ngi.s",
"./nop.s",
"./print.s",
"./rck.s",
"./ret6.s",
"./ret8.s",
"./retarea.s",
"./return.s",
"./rmi4.s",
"./rmi.s",
"./rmu4.s",
"./rmu.s",
"./rol.s",
"./ror.s",
"./sar2.s",
"./sbi.s",
"./set.s",
"./sli.s",
"./sri.s",
"./sti.s",
"./strhp.s",
"./trp.s",
"./unknown.s",
"./xor.s",
},
vars = { plat = plat },
}
end

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

8
mach/i86/ncg/build.lua Normal file
View file

@ -0,0 +1,8 @@
bundle {
name = "headers",
srcs = {
"./mach.c",
"./mach.h"
}
}

12
mach/m68020/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -141,12 +141,12 @@ main(argc, argv)
}
switch (argc) {
case 1: break;
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
output_file = argv[2];
outputfile_created = 1;
/* FALLTHROUGH */
case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0)
case 2: if ((input = fopen(argv[1], "rb")) == (FILE *)0)
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <as object> <dl object>.\n", argv[0]);

View file

@ -2,8 +2,37 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.s", -- csb8.s
"./*.c"
"./aar.s",
"./cii.s",
"./cmi.s",
"./cms.s",
"./cmu.s",
"./csa8.s",
"./csa.s",
"./csb8.s",
"./csb.s",
"./cuu.s",
"./cvf.s",
"./dia.s",
"./divrem8.s",
"./dvi8.s",
"./dvu8.s",
"./exg.s",
"./fat.s",
"./fp68881.s",
"./inn.s",
"./lar.s",
"./los.s",
"./mon.s",
"./nop.s",
"./rmi8.s",
"./rmu8.s",
"./sar.s",
"./set.s",
"./shp.s",
"./sts.s",
"./trp.s",
"./trpstr.c",
},
vars = { plat = plat },
deps = {

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

View file

@ -0,0 +1,9 @@
bundle {
name = "headers",
srcs = {
"./mach.c",
"./mach.h",
"./whichone.h"
}
}

View file

@ -102,12 +102,12 @@ main(argc, argv)
}
switch (argc) {
case 1: break;
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
ofile = argv[2];
ofile_created = 1;
/* FALLTHROUGH */
case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0)
case 2: if ((input = fopen(argv[1], "rb")) == (FILE *)0)
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <as object> <dl object>.\n", argv[0]);

View file

@ -38,12 +38,12 @@ main(argc, argv)
program= argv[0] ;
switch (argc) {
case 1: break;
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
output_file = argv[2];
output_file_created = 1;
/* FALLTHROUGH */
case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0)
case 2: if ((input = fopen(argv[1], "rb")) == (FILE *)0)
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <as object> <dl object>.\n", argv[0]);

View file

@ -36,11 +36,11 @@ main(argc,argv) char **argv; {
fprintf(stderr,"Usage: %s VU-a.out Bleasdale-a.out\n",argv[0]);
exit(-1);
}
if (freopen(argv[1],"r",stdin)==NULL) {
if (freopen(argv[1],"rb",stdin)==NULL) {
perror(argv[1]);
exit(-1);
}
if (freopen(argv[2],"w",stdout)==NULL) {
if (freopen(argv[2],"wb",stdout)==NULL) {
perror(argv[2]);
exit(-1);
}

View file

@ -108,7 +108,7 @@ main(argc, argv)
case 3: if (! wr_open(argv[2]))
fatal("Can't write %s.\n", argv[2]);
output_file = argv[2];
if ((input = fopen(argv[1], "r")) == (FILE *)0)
if ((input = fopen(argv[1], "rb")) == (FILE *)0)
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <Mantra object> <ACK object>.\n", argv[0]);

View file

@ -107,7 +107,7 @@ main(argc, argv)
argc-- ; argv++ ;
}
switch (argc) {
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
output_file = argv[2];
outputfile_created = 1;

View file

@ -4,3 +4,16 @@ normalrule {
ins = {"./mktables.lua", "./instructions.dat"},
commands = {"$(LUA) %{ins[1]} %{outs} < %{ins[2]}"}
}
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -139,19 +139,19 @@ while true do
end
end
local definitionsfp = io.open(args[1], "w")
local definitionsfp = io.open(args[1], "wb")
for word, value in pairs(words) do
definitionsfp:write("%token <y_word> OP_", tostring(value), " /* ", word, " */\n")
end
definitionsfp:close()
local tokensfp = io.open(args[2], "w")
local tokensfp = io.open(args[2], "wb")
for word, value in pairs(words) do
tokensfp:write("0, OP_", value, ", 0, \"", word, "\",\n")
end
tokensfp:close()
local rulesfp = io.open(args[3], "w")
local rulesfp = io.open(args[3], "wb")
rulesfp:write("operation\n")
for index, insn in ipairs(insns) do
if index == 1 then

View file

@ -6,7 +6,33 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.s", -- dus4.s
"./aar4.s",
"./and.s",
"./bls4.s",
"./cms.s",
"./compareul.s",
"./com.s",
"./csa.s",
"./csb.s",
"./c_ud_i.s",
"./c_uf_i.s",
"./c_ui_d.s",
"./c_ui_f.s",
"./dus4.s",
"./exg.s",
"./fef8.s",
"./fif8.s",
"./inn.s",
"./ior.s",
"./lar4.s",
"./los4.s",
"./rck.s",
"./sar4.s",
"./set.s",
"./sts4.s",
"./trp.s",
"./xor.s",
"./zer.s",
},
vars = { plat = plat },
deps = {

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

7
mach/mips/mcg/build.lua Normal file
View file

@ -0,0 +1,7 @@
bundle {
name = "headers",
srcs = {
"./platform.c",
}
}

12
mach/pdp/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -1,6 +1,6 @@
cprogram {
name = "cv",
srcs = { "./*.c" },
srcs = { "./cv.c" },
deps = {
"h+emheaders",
"modules/src/object+lib",

View file

@ -86,7 +86,7 @@ main(argc, argv)
switch (argc) {
case 1: rd_fdopen(0);
break;
case 3: if ((output = fopen(argv[2], "w")) == NULL) {
case 3: if ((output = fopen(argv[2], "wb")) == NULL) {
fatal("Can't write %s.\n", argv[2]);
}
output_file = argv[2];

View file

@ -1,7 +1,79 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./aar.s",
"./adf.s",
"./adi.s",
"./and.s",
"./cff.s",
"./cfi.s",
"./cif.s",
"./cii.s",
"./ciu.s",
"./cmf.s",
"./cmi4.s",
"./cmi.s",
"./cms.s",
"./cmu4.s",
"./cmu.s",
"./csa.s",
"./csb.s",
"./dup.s",
"./dvf.s",
"./dvi4.s",
"./dvi.s",
"./dvu2.s",
"./dvu4.s",
"./dvu.s",
"./eret.s",
"./exg.s",
"./fef.s",
"./fif.s",
"./gto.s",
"./iaar.s",
"./ilar.s",
"./inn.s",
"./isar.s",
"./lar.s",
"./los2.s",
"./mlf.s",
"./mli4.s",
"./mli.s",
"./mlu4.s",
"./mlu.s",
"./mon.s",
"./ngf.s",
"./ngi.s",
"./nop.s",
"./prf.s",
"./printf.s",
"./rck.s",
"./ret.s",
"./rmi4.s",
"./rmi.s",
"./rmu2.s",
"./rmu4.s",
"./rmu.s",
"./rol.s",
"./ror.s",
"./RT.s",
"./sar.s",
"./save.s",
"./sbf.s",
"./sbi.s",
"./setfl.s",
"./set.s",
"./sim.s",
"./sli.s",
"./sri.s",
"./sru.s",
"./sto2.s",
"./strhp.s",
"./trp.s",
"./unknown.s",
"./xor.s",
},
vars = { plat = plat },
}
end

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

View file

@ -88,7 +88,7 @@ main(argc, argv)
argc-- ; argv++ ;
}
switch (argc) {
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
case 3: if ((output = fopen(argv[2], "wb")) == (FILE *)0)
fatal("Can't write %s.\n", argv[2]);
output_file = argv[2];
outputfile_created = 1;

12
mach/powerpc/as/build.lua Normal file
View file

@ -0,0 +1,12 @@
bundle {
name = "headers",
srcs = {
"./mach0.c",
"./mach1.c",
"./mach2.c",
"./mach3.c",
"./mach4.c",
"./mach5.c",
}
}

View file

@ -6,7 +6,35 @@ for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = {
"./*.s", -- dus4.s
"./aar4.s",
"./and.s",
"./bls4.s",
"./cfi8.s",
"./cfu8.s",
"./cif8.s",
"./cms.s",
"./com.s",
"./csa.s",
"./csb.s",
"./cuf8.s",
-- "./dus4.s",
"./exg.s",
"./fd_00000000.s",
"./fef4.s",
"./fef8.s",
"./fif4.s",
"./fif8.s",
"./inn.s",
"./ior.s",
"./lar4.s",
"./los4.s",
"./rck.s",
"./sar4.s",
"./set.s",
"./sts4.s",
"./trp.s",
"./xor.s",
"./zer.s",
},
vars = { plat = plat },
deps = {

View file

@ -1,7 +1,12 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
srcs = {
"./edata.s",
"./em_end.s",
"./end.s",
"./etext.s",
},
vars = { plat = plat },
}
end

View file

@ -0,0 +1,7 @@
bundle {
name = "headers",
srcs = {
"./platform.c",
}
}

View file

@ -0,0 +1,8 @@
bundle {
name = "headers",
srcs = {
"./mach.c",
"./mach.h"
}
}

View file

@ -1,4 +1,4 @@
include("first/yacc.lua")
include("first/bison.lua")
definerule("build_as",
{
@ -11,14 +11,11 @@ definerule("build_as",
local archlib = clibrary {
name = e.name.."/archlib",
srcs = {},
hdrs = {
"mach/"..e.arch.."/as/mach*.c",
"mach/"..e.arch.."/as/*.h"
}
hdrs = { "mach/"..e.arch.."/as+headers" },
}
local preprocessedy = cppfile {
name = e.name.."/yaccinput",
name = e.name.."/bisoninput",
srcs = { "mach/proto/as/comm2.y" },
outleaf = "comm2.y",
deps = {
@ -30,23 +27,28 @@ definerule("build_as",
},
}
local yaccfiles = yacc {
name = e.name.."/yacc",
local bisonfiles = bison {
name = e.name.."/bison",
srcs = { preprocessedy }
}
return cprogram {
name = e.name,
srcs = concat(
"mach/proto/as/*.c",
matching(filenamesof(yaccfiles), "%.c$")
"mach/proto/as/comm3.c",
"mach/proto/as/comm4.c",
"mach/proto/as/comm5.c",
"mach/proto/as/comm6.c",
"mach/proto/as/comm7.c",
"mach/proto/as/comm8.c",
matching(filenamesof(bisonfiles), "%.c$")
),
deps = {
"h+emheaders",
"modules/src/object+lib",
"modules/src/flt_arith+lib",
archlib,
yaccfiles,
bisonfiles,
e.deps
}
}

View file

@ -44,9 +44,6 @@ main(int argc, char **argv)
{
char *p;
int i;
static char sigs[] = {
SIGHUP, SIGINT, SIGQUIT, SIGTERM, 0
};
/* the next test should be performed by the
* preprocessor, but it cannot, so it is performed by the compiler.
@ -58,9 +55,8 @@ main(int argc, char **argv)
}
progname = *argv++; argc--;
for (p = sigs; (i = *p++) != 0; )
if (signal(i, SIG_IGN) != SIG_IGN)
signal(i, stop_on_signal);
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, stop_on_signal);
for (i = 0; i < argc; i++) {
p = argv[i];
if (*p++ != '-')
@ -169,7 +165,7 @@ pass_1(int argc, char **argv)
continue;
}
#endif
if ((input = fopen(p, "r")) == NULL)
if ((input = fopen(p, "rb")) == NULL)
fatal("can't open %s", p);
#ifdef ASLD
if (

View file

@ -11,9 +11,24 @@ definerule("build_cg",
name = e.name.."/headers",
srcs = {},
hdrs = {
"mach/proto/cg/*.h",
"mach/proto/cg/assert.h",
"mach/proto/cg/codegen.h",
"mach/proto/cg/data.h",
"mach/proto/cg/equiv.h",
"mach/proto/cg/extern.h",
"mach/proto/cg/fillem.h",
"mach/proto/cg/gencode.h",
"mach/proto/cg/glosym.h",
"mach/proto/cg/param.h",
"mach/proto/cg/reg.h",
"mach/proto/cg/regvar.h",
"mach/proto/cg/result.h",
"mach/proto/cg/salloc.h",
"mach/proto/cg/state.h",
"mach/proto/cg/subr.h",
"mach/proto/cg/types.h",
"mach/"..e.arch.."/cg/mach.c",
"mach/"..e.arch.."/cg/*.h",
"mach/"..e.arch.."/cg/mach.h",
}
}
@ -25,7 +40,21 @@ definerule("build_cg",
return cprogram {
name = e.name,
srcs = {
"mach/proto/cg/*.c",
"mach/proto/cg/codegen.c",
"mach/proto/cg/compute.c",
"mach/proto/cg/equiv.c",
"mach/proto/cg/fillem.c",
"mach/proto/cg/gencode.c",
"mach/proto/cg/glosym.c",
"mach/proto/cg/main.c",
"mach/proto/cg/move.c",
"mach/proto/cg/nextem.c",
"mach/proto/cg/reg.c",
"mach/proto/cg/regvar.c",
"mach/proto/cg/salloc.c",
"mach/proto/cg/state.c",
"mach/proto/cg/subr.c",
"mach/proto/cg/var.c",
matching(filenamesof(tables), "%.c$")
},
deps = {

View file

@ -141,7 +141,7 @@ static long our_atol(register char *s)
void in_init(char *filename) {
if ((emfile=freopen(filename,"r",stdin))==NULL)
if ((emfile=freopen(filename,"rb",stdin))==NULL)
error("Can't open %s",filename);
if (get16()!=sp_magic)
error("Bad format %s",filename);

View file

@ -34,7 +34,7 @@ void out_init(char *filename)
#endif
if (filename == (char *) 0)
codefile = stdout;
else if ((codefile = freopen(filename, "w", stdout)) == NULL)
else if ((codefile = freopen(filename, "wb", stdout)) == NULL)
error("Can't create %s", filename);
#ifndef NDEBUG
}

View file

@ -1,40 +0,0 @@
g/_adf4/s//.adf4/g
g/_adf8/s//.adf8/g
g/_cff4/s//.cff4/g
g/_cff8/s//.cff8/g
g/_cfi/s//.cfi/g
g/_cfu/s//.cfu/g
g/_cif4/s//.cif4/g
g/_cif8/s//.cif8/g
g/_cmf4/s//.cmf4/g
g/_cmf8/s//.cmf8/g
g/_cuf4/s//.cuf4/g
g/_cuf8/s//.cuf8/g
g/_dvf4/s//.dvf4/g
g/_dvf8/s//.dvf8/g
g/_fef4/s//.fef4/g
g/_fef8/s//.fef8/g
g/_fif4/s//.fif4/g
g/_fif8/s//.fif8/g
g/_mlf4/s//.mlf4/g
g/_mlf8/s//.mlf8/g
g/_ngf4/s//.ngf4/g
g/_ngf8/s//.ngf8/g
g/_sbf4/s//.sbf4/g
g/_sbf8/s//.sbf8/g
g/_zrf4/s//.zrf4/g
g/_zrf8/s//.zrf8/g
g/_add_ext/s//.add_ext/g
g/_div_ext/s//.div_ext/g
g/_mul_ext/s//.mul_ext/g
g/_nrm_ext/s//.nrm_ext/g
g/_sft_ext/s//.sft_ext/g
g/_sub_ext/s//.sub_ext/g
g/_zrf_ext/s//.zrf_ext/g
g/_compact/s//.compact/g
g/_extend/s//.extend/g
g/_b64_add/s//.b64_add/g
g/_b64_sft/s//.b64_sft/g
g/_b64_rsft/s//.b64_rsft/g
g/_b64_lsft/s//.b64_lsft/g
1,$p

Some files were not shown because too many files have changed in this diff Show more