Make the em interpreter build --- again, lots of warnings, so it probably won't

work on clang. I have no idea whether it runs or not as building a e.out
program is quite hard and needs a special platform.
This commit is contained in:
David Given 2018-06-09 21:13:31 +09:00
parent d10a594c04
commit 59b383afd0
9 changed files with 138 additions and 58 deletions

View file

@ -47,7 +47,7 @@ installable {
"util/arch+pkg", "util/arch+pkg",
"util/ass+pkg", "util/ass+pkg",
"util/ego+pkg", "util/ego+pkg",
"util/ass+pkg", "util/int+pkg",
"util/led+pkg", "util/led+pkg",
"util/misc+pkg", "util/misc+pkg",
"util/opt+pkg", "util/opt+pkg",

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id$ # $Id$
(
echo '/* This file is generated from '$1'; do not edit */' echo '/* This file is generated from '$1'; do not edit */'
cat $1 | cat $1 |
@ -9,13 +8,4 @@
s/..// s/..//
s/.*/ "&",/ s/.*/ "&",/
' '
) >\#trap_msg
if # the new one unchanged
cmp -s \#trap_msg trap_msg
then # throw it away
rm \#trap_msg
else # overwrite old version
mv \#trap_msg trap_msg
fi

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id$ # $Id$
(
echo '/* This file is generated from '$1'; do not edit */' echo '/* This file is generated from '$1'; do not edit */'
cat $1 | cat $1 |
@ -11,13 +10,4 @@
' '
echo '#define warning(n) do_warn((n), __LINE__, __FILE__)' echo '#define warning(n) do_warn((n), __LINE__, __FILE__)'
) >\#warn.h
if # the new one unchanged
cmp -s \#warn.h warn.h
then # throw it away
rm \#warn.h
else # overwrite old version
mv \#warn.h warn.h
fi

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id$ # $Id$
(
echo '/* This file is generated from '$1'; do not edit */' echo '/* This file is generated from '$1'; do not edit */'
cat $1 | cat $1 |
@ -12,13 +11,4 @@
s/"[ ][ ]*W/", W/ s/"[ ][ ]*W/", W/
s/\\-/-/g s/\\-/-/g
' '
) >\#warn_msg
if # the new one unchanged
cmp -s \#warn_msg warn_msg
then # throw it away
rm \#warn_msg
else # overwrite old version
mv \#warn_msg warn_msg
fi

View file

@ -4,9 +4,6 @@
#include "global.h" #include "global.h"
#include "alloc.h" #include "alloc.h"
extern char *malloc();
extern char *realloc();
char *Malloc(sz, descr) char *Malloc(sz, descr)
size sz; size sz;
char *descr; char *descr;

110
util/int/build.lua Normal file
View file

@ -0,0 +1,110 @@
normalrule {
name = "trap_msg",
ins = {
"./M.trap_msg",
"etc/traps"
},
outleaves = {"trap_msg"},
commands = {
"%{ins} > %{outs}"
}
}
normalrule {
name = "warn_msg",
ins = {
"./M.warn_msg",
"etc/traps"
},
outleaves = {"warn_msg"},
commands = {
"%{ins} > %{outs}"
}
}
normalrule {
name = "warn_h",
ins = {
"./M.warn_h",
"doc/int/appA" -- there's a 1991 comment saying this needs to be moved
},
outleaves = {"warn.h"},
commands = {
"%{ins} > %{outs}"
}
}
cprogram {
name = "mkiswitch",
srcs = {"./switch/mkiswitch.c"},
deps = {
"h+emheaders",
"modules/src/em_data+lib",
}
}
normalrule {
name = "docases",
ins = {
"+mkiswitch",
"etc/ip_spec.t"
},
outleaves = {"DoCases"},
commands = {
"%{ins[1]} Do %{ins[2]} %{outs}"
}
}
cprogram {
name = "mkswitch",
srcs = {"./switch/mkswitch.c"}
}
normalrule {
name = "prcases",
ins = {
"+mkswitch",
"etc/ip_spec.t"
},
outleaves = {"PrCases"},
commands = {
"%{ins[1]} Pr %{ins[2]} %{outs}"
}
}
clibrary {
name = "generated",
srcs = {},
hdrs = {
"+warn_msg",
"+trap_msg",
"+warn_h",
"+docases",
"+prcases",
}
}
cprogram {
name = "int",
srcs = {
"./*.c",
},
deps = {
"h+emheaders",
"+generated",
"modules/src/em_data+lib",
},
vars = {
["+cflags"] = {"-Wno-implicit-int"}
}
}
installable {
name = "pkg",
map = {
["$(PLATDEP)/int"] = "+int",
["$(INSDIR)/share/man/man1/int.1"] = "./int.1",
}
}

View file

@ -1758,7 +1758,7 @@ PRIVATE do_pr_instr(opcode)
unsigned int opcode; unsigned int opcode;
{ {
switch (opcode) { switch (opcode) {
#include "switch/PrCases" /* for the muscle */ #include "PrCases" /* for the muscle */
case SECONDARY: case SECONDARY:
do_pr_instr(SEC_BASE + nextTCbyte()); do_pr_instr(SEC_BASE + nextTCbyte());
break; break;

View file

@ -4,6 +4,9 @@
/* $Id$ */ /* $Id$ */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/********* PRIVATE/static *********/ /********* PRIVATE/static *********/

View file

@ -15,7 +15,7 @@ do_instr(opcode)
unsigned int opcode; unsigned int opcode;
{ {
switch (opcode) { switch (opcode) {
#include "switch/DoCases" /* for the muscle */ #include "DoCases" /* for the muscle */
case SECONDARY: case SECONDARY:
do_instr(SEC_BASE + nextPCbyte()); do_instr(SEC_BASE + nextPCbyte());
break; break;