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/ass+pkg",
"util/ego+pkg",
"util/ass+pkg",
"util/int+pkg",
"util/led+pkg",
"util/misc+pkg",
"util/opt+pkg",

View file

@ -1,21 +1,11 @@
#!/bin/sh
# $Id$
(
echo '/* This file is generated from '$1'; do not edit */'
echo '/* This file is generated from '$1'; do not edit */'
cat $1 |
sed '
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
cat $1 |
sed '
s/..//
s/.*/ "&",/
'

View file

@ -1,23 +1,13 @@
#!/bin/sh
# $Id$
(
echo '/* This file is generated from '$1'; do not edit */'
echo '/* This file is generated from '$1'; do not edit */'
cat $1 |
grep '^\.Wn' |
sed '
s/.*"/#define /
'
cat $1 |
grep '^\.Wn' |
sed '
s/.*"/#define /
'
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
echo '#define warning(n) do_warn((n), __LINE__, __FILE__)'

View file

@ -1,24 +1,14 @@
#!/bin/sh
# $Id$
(
echo '/* This file is generated from '$1'; do not edit */'
echo '/* This file is generated from '$1'; do not edit */'
cat $1 |
grep '^\.Wn' |
sed '
s/^\.Wn[ ]*/ {/
s/[ ]*[0-9][0-9]*$/},/
s/"[ ][ ]*W/", W/
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
cat $1 |
grep '^\.Wn' |
sed '
s/^\.Wn[ ]*/ {/
s/[ ]*[0-9][0-9]*$/},/
s/"[ ][ ]*W/", W/
s/\\-/-/g
'

View file

@ -4,9 +4,6 @@
#include "global.h"
#include "alloc.h"
extern char *malloc();
extern char *realloc();
char *Malloc(sz, descr)
size sz;
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;
{
switch (opcode) {
#include "switch/PrCases" /* for the muscle */
#include "PrCases" /* for the muscle */
case SECONDARY:
do_pr_instr(SEC_BASE + nextTCbyte());
break;

View file

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

View file

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