Merge pull request #63 from kernigh/kernigh-rm-fix
small changes to C, Pascal, Modula-2, em_opt, getopt(), Makefile
This commit is contained in:
commit
8c80fa7334
56
Makefile
56
Makefile
|
@ -63,29 +63,50 @@ PLATDEP = $(INSDIR)/lib/ack
|
|||
|
||||
.NOTPARALLEL:
|
||||
|
||||
MAKECMDGOALS ?= +ack +tests
|
||||
BUILD_FILES = $(shell find * -name '*.lua')
|
||||
|
||||
ifneq ($(shell which ninja),)
|
||||
ifeq ($(BUILDSYSTEM),)
|
||||
ifneq ($(shell which ninja),)
|
||||
BUILDSYSTEM = ninja
|
||||
BUILDFLAGS = $(NINJAFLAGS)
|
||||
else
|
||||
else
|
||||
BUILDSYSTEM = make
|
||||
BUILDFLAGS = $(MAKEFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
LUA = $(BUILDDIR)/lua
|
||||
build-file = $(BUILDDIR)/build.$(BUILDSYSTEM)
|
||||
lua-files = $(shell find * -name '*.lua')
|
||||
our-lua = $(BUILDDIR)/lua
|
||||
|
||||
ifneq ($(findstring +, $(MAKECMDGOALS)),)
|
||||
# GNU make sets MAKECMDGOALS to the list of targets from the command
|
||||
# line. We look for targets with '+' and forward them to BUILDSYSTEM.
|
||||
# This handles commands like
|
||||
# $ make util/opt+pkg util/ego+pkg
|
||||
|
||||
$(MAKECMDGOALS): $(BUILDDIR)/build.$(BUILDSYSTEM)
|
||||
@$(BUILDSYSTEM) $(BUILDFLAGS) -f $^ $(MAKECMDGOALS)
|
||||
all-goals = +ack +tests
|
||||
plus-goals := $(patsubst all,$(all-goals),$(or $(MAKECMDGOALS),all))
|
||||
plus-goals := $(foreach g,$(plus-goals),$(if $(findstring +,$(g)),$(g),))
|
||||
|
||||
# @true silences extra message, "make: Nothing to be done..."
|
||||
|
||||
all: build-plus-goals
|
||||
@true
|
||||
|
||||
ifneq ($(plus-goals),)
|
||||
$(plus-goals): build-plus-goals
|
||||
@true
|
||||
endif
|
||||
|
||||
$(BUILDDIR)/build.$(BUILDSYSTEM): first/ackbuilder.lua Makefile $(BUILD_FILES) $(LUA)
|
||||
build-plus-goals: $(build-file)
|
||||
ifeq ($(BUILDSYSTEM),ninja)
|
||||
@ninja $(NINJAFLAGS) -f $(build-file) $(plus-goals)
|
||||
else ifeq ($(BUILDSYSTEM),make)
|
||||
# GNU make passes MAKEFLAGS in environment.
|
||||
@$(MAKE) -f $(build-file) $(plus-goals)
|
||||
else
|
||||
$(error unknown BUILDSYSTEM = $(BUILDSYSTEM))
|
||||
endif
|
||||
|
||||
$(build-file): first/ackbuilder.lua Makefile $(lua-files) $(our-lua)
|
||||
@mkdir -p $(BUILDDIR)
|
||||
@$(LUA) first/ackbuilder.lua \
|
||||
@$(our-lua) first/ackbuilder.lua \
|
||||
first/build.lua build.lua \
|
||||
--$(BUILDSYSTEM) \
|
||||
DEFAULT_PLATFORM=$(DEFAULT_PLATFORM) \
|
||||
|
@ -99,17 +120,16 @@ $(BUILDDIR)/build.$(BUILDSYSTEM): first/ackbuilder.lua Makefile $(BUILD_FILES) $
|
|||
PREFIX=$(PREFIX) \
|
||||
AR=$(AR) \
|
||||
CC=$(CC) \
|
||||
> $(BUILDDIR)/build.$(BUILDSYSTEM)
|
||||
> $(build-file)
|
||||
|
||||
install:
|
||||
mkdir -p $(PREFIX)
|
||||
tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
|
||||
|
||||
clean:
|
||||
@rm -rf $(BUILDDIR)
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
$(LUA): first/lua-5.1/*.c first/lua-5.1/*.h
|
||||
$(our-lua): first/lua-5.1/*.c first/lua-5.1/*.h
|
||||
@echo Bootstrapping build
|
||||
@mkdir -p $(BUILDDIR)
|
||||
@$(CC) -o $(LUA) -O first/lua-5.1/*.c -lm
|
||||
|
||||
@$(CC) -o $(our-lua) -O first/lua-5.1/*.c -lm
|
||||
|
|
8
README
8
README
|
@ -53,8 +53,6 @@ Requirements:
|
|||
|
||||
- GNU make.
|
||||
|
||||
- Lua 5.1 and the luaposix library (used by the build system).
|
||||
|
||||
- (optionally) ninja; if you've got this, this will be autodetected and give
|
||||
you faster builds.
|
||||
|
||||
|
@ -63,9 +61,9 @@ Requirements:
|
|||
architectures. Get both the qemu-system-* platform emulators and the qemu-*
|
||||
userland emulators (only works on Linux).
|
||||
|
||||
- about 40MB free in /tmp (or some other temporary directory).
|
||||
- about 115MB free in /tmp (or some other temporary directory).
|
||||
|
||||
- about 6MB in the target directory.
|
||||
- about 15MB in the target directory.
|
||||
|
||||
Instructions:
|
||||
|
||||
|
@ -83,7 +81,7 @@ Instructions:
|
|||
install ninja and it'll use all your cores. If you don't have ninja, you
|
||||
can still use make for parallel builds with:
|
||||
|
||||
make MAKEFLAGS='-r -j8' # or however many cores you have
|
||||
make -r -j8 # or however many cores you have
|
||||
|
||||
...but frankly, I recommend ninja.
|
||||
|
||||
|
|
146
TakeAction
146
TakeAction
|
@ -1,146 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
case $# in
|
||||
0) PAR='make install && make clean' ; CMD=Action ;;
|
||||
1) PAR="$1" ; CMD=Action ;;
|
||||
2) PAR="$1" ; CMD="$2" ;;
|
||||
*) echo Syntax: "$0" [command [file]] ; exit 1 ;;
|
||||
esac
|
||||
if test -r "$CMD"
|
||||
then :
|
||||
else
|
||||
case "$CMD" in
|
||||
Action) echo No Action file present ;;
|
||||
*) echo No Action file "($CMD)" present ;;
|
||||
esac
|
||||
fi
|
||||
case $0 in
|
||||
/*) THISFILE=$0
|
||||
;;
|
||||
*) if [ -f $0 ]
|
||||
then
|
||||
THISFILE=`pwd`/$0
|
||||
else
|
||||
THISFILE=$0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
SYS=
|
||||
RETC=0
|
||||
{ while read LINE
|
||||
do
|
||||
eval set $LINE
|
||||
case x"$1" in
|
||||
x!*) ;;
|
||||
xname) SYS="$2"
|
||||
ACTION='$PAR'
|
||||
DIR=.
|
||||
FM=no
|
||||
FAIL='Failed for $SYS, see $DIR/Out'
|
||||
SUCC='$SYS -- done'
|
||||
ATYPE=
|
||||
FATAL=no
|
||||
DOIT=yes
|
||||
;;
|
||||
xfatal) FATAL=yes ;;
|
||||
xaction|xindir) case x$ATYPE in
|
||||
x) ACTION=$2 ; ATYPE=$1
|
||||
case $ATYPE$FM in
|
||||
indirno) FAIL='Failed for $SYS' ;;
|
||||
esac
|
||||
;;
|
||||
*) echo Already specified an $ATYPE for this name
|
||||
RETC=65 ;;
|
||||
esac ;;
|
||||
xfailure) FM=yes
|
||||
FAIL="$2" ;;
|
||||
xsuccess) SUCC="$2" ;;
|
||||
xdir) DIR="$2" ;;
|
||||
xsystem) PAT="$2"
|
||||
oIFS=$IFS
|
||||
IFS="|"
|
||||
eval set $2
|
||||
case x`ack_sys` in
|
||||
x$1|x$2|x$3|x$4|x$5|x$6|x$7) ;;
|
||||
*) echo "Sorry, $SYS can only be made on $PAT systems"
|
||||
DOIT=no
|
||||
;;
|
||||
esac
|
||||
IFS=$oIFS
|
||||
;;
|
||||
xend) case $DOIT in
|
||||
no) continue ;;
|
||||
esac
|
||||
case x$SYS in
|
||||
x) echo Missing name line; RETC=65 ;;
|
||||
*) if test -d $DIR
|
||||
then (
|
||||
cd $DIR
|
||||
X=
|
||||
case $ATYPE in
|
||||
indir)
|
||||
if $THISFILE "$PAR" $ACTION
|
||||
then eval echo $SUCC
|
||||
else RETC=2 ; eval echo $FAIL
|
||||
fi ;;
|
||||
*)
|
||||
case "$ACTION" in
|
||||
'$PAR')
|
||||
ACTION="$PAR"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
if [ -f No$CMD ]
|
||||
then
|
||||
x=`cat No$CMD`
|
||||
if [ "$ACTION" = "$x" ]
|
||||
then
|
||||
ACTION='echo "No actions performed, No$CMD file present"'
|
||||
SUCC='$SYS -- skipped'
|
||||
fi
|
||||
fi
|
||||
if eval "{ $ACTION ; } >Out 2>&1 </dev/null"
|
||||
then eval echo $SUCC
|
||||
if [ "$SUCC" = '$SYS -- skipped' ]
|
||||
then :
|
||||
else echo "$ACTION" > No$CMD 2>/dev/null
|
||||
fi
|
||||
else RETC=1 ; X=: ; eval echo $FAIL
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
(echo ------- `pwd`
|
||||
cat Out
|
||||
$X rm -f Out
|
||||
) 2>/dev/null 1>&- 1>&3
|
||||
exit $RETC
|
||||
)
|
||||
case $? in
|
||||
0) ;;
|
||||
*) case $RETC in
|
||||
0) RETC=$? ;;
|
||||
esac ;;
|
||||
esac
|
||||
else
|
||||
echo Directory $DIR for $SYS is inaccessible
|
||||
RETC=66
|
||||
fi ;;
|
||||
esac
|
||||
case $FATAL$RETC in
|
||||
yes0) ;;
|
||||
yes*) echo Fatal error, installation stopped.
|
||||
exit $RETC ;;
|
||||
esac
|
||||
SYS=
|
||||
;;
|
||||
*) echo Unknown keyword "$1"
|
||||
RETC=67 ;;
|
||||
esac
|
||||
done
|
||||
exit $RETC
|
||||
} <$CMD
|
||||
RETX=$?
|
||||
case $RETX in
|
||||
0) exit $RETC ;;
|
||||
*) exit $RETX ;;
|
||||
esac
|
71
config.pm
71
config.pm
|
@ -1,71 +0,0 @@
|
|||
-- ======================================================================= --
|
||||
-- ACK CONFIGURATION --
|
||||
-- (Edit this before building) --
|
||||
-- ======================================================================= --
|
||||
|
||||
-- What platform to build for by default?
|
||||
|
||||
DEFAULT_PLATFORM = "pc86"
|
||||
|
||||
-- Where should the ACK put its temporary files?
|
||||
|
||||
ACK_TEMP_DIR = "/tmp"
|
||||
|
||||
-- Where is the ACK going to be installed, eventually?
|
||||
|
||||
PREFIX = "/tmp/ack-temp/staging"
|
||||
|
||||
-- ======================================================================= --
|
||||
-- BROKEN ACK CONFIGURATION --
|
||||
-- (Currently not editable) --
|
||||
-- ======================================================================= --
|
||||
|
||||
-- FIXME: the following two variables must be set to their Minix variants
|
||||
-- due to hard-coded references in the descr files.
|
||||
|
||||
-- Name of the platform-independent library directory; 'share' on modern
|
||||
-- systems, 'lib' on Minix-like systems.
|
||||
|
||||
PLATIND = "lib"
|
||||
|
||||
-- Name of the platform-dependent library directory; 'lib' on modern
|
||||
-- systems, 'lib.bin' on Minix-like systems.
|
||||
|
||||
PLATDEP = "lib.bin"
|
||||
|
||||
-- ======================================================================= --
|
||||
-- BUILD SYSTEM CONFIGURATION --
|
||||
-- (Not user servicable) --
|
||||
-- ======================================================================= --
|
||||
|
||||
-- Absolute path to the ACK source directory.
|
||||
|
||||
ROOTDIR = posix.getcwd().."/"
|
||||
|
||||
-- Temporary directory used during the build process.
|
||||
|
||||
TEMPDIR = "/tmp/ack-temp/"
|
||||
|
||||
-- Directory in which dynamically generated header files will go during
|
||||
-- the build process.
|
||||
|
||||
HEADERDIR = TEMPDIR.."headers/"
|
||||
|
||||
-- Directory in which tools used by the build process but which not actually
|
||||
-- deployed with the ACK will go.
|
||||
|
||||
TOOLDIR = TEMPDIR.."tools/"
|
||||
|
||||
-- Directory in which the libraries used to build the ACK tools but which are
|
||||
-- not actually deployed with the ACK will go.
|
||||
|
||||
LIBDIR = TEMPDIR.."lib/"
|
||||
|
||||
-- Staging area where the installation will be built before actually copying
|
||||
-- it.
|
||||
|
||||
BINDIR = TEMPDIR.."staging/"
|
||||
|
||||
-- Directory that the pm cache goes in.
|
||||
|
||||
pm.intermediate_cache_dir = TEMPDIR.."pmcache/"
|
|
@ -122,7 +122,6 @@
|
|||
!File: spec_arith.h
|
||||
/* describes internal compiler arithmetics */
|
||||
/*#define SPECIAL_ARITHMETICS /* something different from native long */
|
||||
#define UNSIGNED_ARITH unsigned arith /* when it is supported */
|
||||
|
||||
|
||||
!File: static.h
|
||||
|
|
|
@ -95,7 +95,3 @@
|
|||
/*#define USE_INSERT 1 /* use C_insertpart mechanism */
|
||||
|
||||
|
||||
!File: uns_arith.h
|
||||
#define UNSIGNED_ARITH unsigned arith
|
||||
|
||||
|
||||
|
|
|
@ -34,12 +34,19 @@ init(char *s, int val)
|
|||
np->offset = val;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
error("Usage: em_b [-w wordsize] [-B modulename] [-i inputfile] [-o outputfile]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
int opt = getopt(argc, argv, "-w:B:i:o:");
|
||||
int opt = getopt(argc, argv, "w:B:i:o:");
|
||||
if (opt == -1)
|
||||
break;
|
||||
|
||||
|
@ -66,11 +73,12 @@ main(int argc, char *argv[])
|
|||
}
|
||||
break;
|
||||
|
||||
derfault:
|
||||
error("Usage: em_b [-w wordsize] [-B modulename] [-i inputfile] [-o outputfile]");
|
||||
exit(1);
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
if (optind < argc)
|
||||
usage();
|
||||
|
||||
init("auto", AUTO);
|
||||
init("extrn", EXTERN);
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
!File: spec_arith.h
|
||||
/* describes internal compiler arithmetics */
|
||||
#undef SPECIAL_ARITHMETICS /* something different from native long */
|
||||
/*#define UNSIGNED_ARITH unsigned arith /* if it is supported */
|
||||
|
||||
|
||||
!File: static.h
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
!File: spec_arith.h
|
||||
/* describes internal compiler arithmetics */
|
||||
#undef SPECIAL_ARITHMETICS /* something different from native long */
|
||||
/*#define UNSIGNED_ARITH unsigned arith /* if it is supported */
|
||||
|
||||
|
||||
!File: static.h
|
||||
|
|
|
@ -47,39 +47,8 @@ cstbin(expp, oper, expr)
|
|||
expr_warning(expr, "division by 0");
|
||||
break;
|
||||
}
|
||||
if (uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
o1 /= (UNSIGNED_ARITH) o2;
|
||||
#else
|
||||
/* this is more of a problem than you might
|
||||
think on C compilers which do not have
|
||||
unsigned arith (== long (probably)).
|
||||
*/
|
||||
if (o2 & arith_sign) {/* o2 > max_arith */
|
||||
o1 = ! (o1 >= 0 || o1 < o2);
|
||||
/* this is the unsigned test
|
||||
o1 < o2 for o2 > max_arith
|
||||
*/
|
||||
}
|
||||
else { /* o2 <= max_arith */
|
||||
arith half, bit, hdiv, hrem, rem;
|
||||
|
||||
half = (o1 >> 1) & ~arith_sign;
|
||||
bit = o1 & 01;
|
||||
/* now o1 == 2 * half + bit
|
||||
and half <= max_arith
|
||||
and bit <= max_arith
|
||||
*/
|
||||
hdiv = half / o2;
|
||||
hrem = half % o2;
|
||||
rem = 2 * hrem + bit;
|
||||
o1 = 2 * hdiv + (rem < 0 || rem >= o2);
|
||||
/* that is the unsigned compare
|
||||
rem >= o2 for o2 <= max_arith
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (uns)
|
||||
o1 /= (unsigned arith) o2;
|
||||
else
|
||||
o1 /= o2;
|
||||
break;
|
||||
|
@ -91,31 +60,8 @@ cstbin(expp, oper, expr)
|
|||
expr_warning(expr, "modulo by 0");
|
||||
break;
|
||||
}
|
||||
if (uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
o1 %= (UNSIGNED_ARITH) o2;
|
||||
#else
|
||||
if (o2 & arith_sign) {/* o2 > max_arith */
|
||||
o1 = (o1 >= 0 || o1 < o2) ? o1 : o1 - o2;
|
||||
/* this is the unsigned test
|
||||
o1 < o2 for o2 > max_arith
|
||||
*/
|
||||
}
|
||||
else { /* o2 <= max_arith */
|
||||
arith half, bit, hrem, rem;
|
||||
|
||||
half = (o1 >> 1) & ~arith_sign;
|
||||
bit = o1 & 01;
|
||||
/* now o1 == 2 * half + bit
|
||||
and half <= max_arith
|
||||
and bit <= max_arith
|
||||
*/
|
||||
hrem = half % o2;
|
||||
rem = 2 * hrem + bit;
|
||||
o1 = (rem < 0 || rem >= o2) ? rem - o2 : rem;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (uns)
|
||||
o1 %= (unsigned arith) o2;
|
||||
else
|
||||
o1 %= o2;
|
||||
break;
|
||||
|
@ -146,16 +92,8 @@ cstbin(expp, oper, expr)
|
|||
}
|
||||
/* Fall through */
|
||||
case '>':
|
||||
if (uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
o1 = (UNSIGNED_ARITH) o1 > (UNSIGNED_ARITH) o2;
|
||||
#else
|
||||
o1 = (o1 & arith_sign ?
|
||||
(o2 & arith_sign ? o1 > o2 : 1) :
|
||||
(o2 & arith_sign ? 0 : o1 > o2)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
if (uns)
|
||||
o1 = (unsigned arith) o1 > (unsigned arith) o2;
|
||||
else
|
||||
o1 = o1 > o2;
|
||||
break;
|
||||
|
@ -168,16 +106,8 @@ cstbin(expp, oper, expr)
|
|||
}
|
||||
/* Fall through */
|
||||
case GREATEREQ:
|
||||
if (uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
o1 = (UNSIGNED_ARITH) o1 >= (UNSIGNED_ARITH) o2;
|
||||
#else
|
||||
o1 = (o1 & arith_sign ?
|
||||
(o2 & arith_sign ? o1 >= o2 : 1) :
|
||||
(o2 & arith_sign ? 0 : o1 >= o2)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
if (uns)
|
||||
o1 = (unsigned arith) o1 >= (unsigned arith) o2;
|
||||
else
|
||||
o1 = o1 >= o2;
|
||||
break;
|
||||
|
|
|
@ -261,7 +261,7 @@ garbage:
|
|||
register int base = 10, vch;
|
||||
register arith val = 0;
|
||||
int ovfl = 0;
|
||||
arith ubound = ~(1<<(sizeof(arith)*8-1))/(base/2);
|
||||
arith ubound = max_arith/(base/2);
|
||||
|
||||
/* Since the preprocessor only knows integers and has
|
||||
* nothing to do with ellipsis we just return when the
|
||||
|
|
|
@ -16,3 +16,7 @@
|
|||
/* All preprocessor arithmetic should be done in longs.
|
||||
*/
|
||||
#define arith long /* dummy */
|
||||
|
||||
#define arith_size (sizeof(arith))
|
||||
#define arith_sign ((arith) 1 << (arith_size * 8 - 1))
|
||||
#define max_arith (~arith_sign)
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "Lpars.h"
|
||||
#include "arith.h"
|
||||
|
||||
#define arith_sign (1L << (sizeof(arith)*8-1))
|
||||
|
||||
ch3bin(pval, pis_uns, oper, val, is_uns)
|
||||
register arith *pval, val;
|
||||
int oper, is_uns, *pis_uns;
|
||||
|
@ -22,37 +20,7 @@ ch3bin(pval, pis_uns, oper, val, is_uns)
|
|||
break;
|
||||
}
|
||||
if (*pis_uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
*pval /= (UNSIGNED_ARITH) val;
|
||||
#else
|
||||
/* this is more of a problem than you might
|
||||
think on C compilers which do not have
|
||||
unsigned arith (== long (probably)).
|
||||
*/
|
||||
if (val & arith_sign) {/* val > max_arith */
|
||||
*pval = ! (*pval >= 0 || *pval < val);
|
||||
/* this is the unsigned test
|
||||
*pval < val for val > max_arith
|
||||
*/
|
||||
}
|
||||
else { /* val <= max_arith */
|
||||
arith half, bit, hdiv, hrem, rem;
|
||||
|
||||
half = (*pval >> 1) & ~arith_sign;
|
||||
bit = *pval & 01;
|
||||
/* now *pval == 2 * half + bit
|
||||
and half <= max_arith
|
||||
and bit <= max_arith
|
||||
*/
|
||||
hdiv = half / val;
|
||||
hrem = half % val;
|
||||
rem = 2 * hrem + bit;
|
||||
*pval = 2 * hdiv + (rem < 0 || rem >= val);
|
||||
/* that is the unsigned compare
|
||||
rem >= val for val <= max_arith
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
*pval /= (unsigned arith) val;
|
||||
}
|
||||
else {
|
||||
*pval = *pval / val;
|
||||
|
@ -64,29 +32,7 @@ ch3bin(pval, pis_uns, oper, val, is_uns)
|
|||
break;
|
||||
}
|
||||
if (*pis_uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
*pval %= (UNSIGNED_ARITH) val;
|
||||
#else
|
||||
if (val & arith_sign) {/* val > max_arith */
|
||||
*pval = (*pval >= 0 || *pval < val) ? *pval : *pval - val;
|
||||
/* this is the unsigned test
|
||||
*pval < val for val > max_arith
|
||||
*/
|
||||
}
|
||||
else { /* val <= max_arith */
|
||||
arith half, bit, hrem, rem;
|
||||
|
||||
half = (*pval >> 1) & ~arith_sign;
|
||||
bit = *pval & 01;
|
||||
/* now *pval == 2 * half + bit
|
||||
and half <= max_arith
|
||||
and bit <= max_arith
|
||||
*/
|
||||
hrem = half % val;
|
||||
rem = 2 * hrem + bit;
|
||||
*pval = (rem < 0 || rem >= val) ? rem - val : rem;
|
||||
}
|
||||
#endif
|
||||
*pval %= (unsigned arith) val;
|
||||
}
|
||||
else {
|
||||
*pval = *pval % val;
|
||||
|
@ -117,14 +63,7 @@ ch3bin(pval, pis_uns, oper, val, is_uns)
|
|||
/* fall through */
|
||||
case '>':
|
||||
if (*pis_uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
*pval = (UNSIGNED_ARITH) *pval > (UNSIGNED_ARITH) val;
|
||||
#else
|
||||
*pval = (*pval & arith_sign ?
|
||||
(val & arith_sign ? *pval > val : 1) :
|
||||
(val & arith_sign ? 0 : *pval > val)
|
||||
);
|
||||
#endif
|
||||
*pval = (unsigned arith) *pval > (unsigned arith) val;
|
||||
}
|
||||
else *pval = (*pval > val);
|
||||
break;
|
||||
|
@ -133,14 +72,7 @@ ch3bin(pval, pis_uns, oper, val, is_uns)
|
|||
/* fall through */
|
||||
case GREATEREQ:
|
||||
if (*pis_uns) {
|
||||
#ifdef UNSIGNED_ARITH
|
||||
*pval = (UNSIGNED_ARITH) *pval >= (UNSIGNED_ARITH) val;
|
||||
#else
|
||||
*pval = (*pval & arith_sign ?
|
||||
(val & arith_sign ? *pval >= val : 1) :
|
||||
(val & arith_sign ? 0 : *pval >= val)
|
||||
);
|
||||
#endif
|
||||
*pval = (unsigned arith) *pval >= (unsigned arith) val;
|
||||
}
|
||||
else *pval = (*pval >= val);
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@ for _, plat in ipairs(vars.plats) do
|
|||
"./errno/*.c",
|
||||
"./locale/*.c",
|
||||
"./malloc/*.c",
|
||||
"./math/*.c",
|
||||
"./math/*.c", -- hypot.c
|
||||
"./math/*.e",
|
||||
"./misc/environ.c", -- don't build everything here as it's all obsolete
|
||||
"./setjmp/*.c",
|
||||
|
|
|
@ -23,4 +23,3 @@ installable {
|
|||
name = "pkg",
|
||||
map = installmap
|
||||
}
|
||||
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* stdlib.h - standard library
|
||||
*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
#define RAND_MAX 32767
|
||||
#define MB_CUR_MAX sizeof(wchar_t)
|
||||
|
||||
typedef struct { int quot, rem; } div_t;
|
||||
typedef struct { long quot, rem; } ldiv_t;
|
||||
|
||||
extern double atof(const char *_nptr);
|
||||
extern int atoi(const char *_nptr);
|
||||
extern long atol(const char *_nptr);
|
||||
extern double strtod(const char *_nptr, char **_endptr);
|
||||
extern long strtol(const char *_nptr, char **_endptr, int _base);
|
||||
extern unsigned long strtoul(const char *_nptr, char **_endptr, int _base);
|
||||
extern int rand(void);
|
||||
extern void srand(unsigned int _seed);
|
||||
extern void* calloc(size_t _nmemb, size_t _size);
|
||||
extern void free(void *_ptr);
|
||||
extern void* malloc(size_t _size);
|
||||
extern void* realloc(void *_ptr, size_t _size);
|
||||
extern void abort(void);
|
||||
extern int atexit(void (*_func)(void));
|
||||
extern void exit(int _status);
|
||||
extern void _Exit(int _status);
|
||||
extern char* getenv(const char *_name);
|
||||
extern int setenv(const char *_name, const char *_value, int _overwrite);
|
||||
extern int unsetenv(const char *_name);
|
||||
extern int putenv(char *_string);
|
||||
extern int system(const char *_string);
|
||||
extern void* bsearch(const void *_key, const void *_base,
|
||||
size_t _nmemb, size_t _size,
|
||||
int (*_compar)(const void *, const void *));
|
||||
extern void qsort(void *_base, size_t _nmemb, size_t _size,
|
||||
int (*_compar)(const void *, const void *));
|
||||
extern int abs(int _j);
|
||||
extern div_t div(int _numer, int _denom);
|
||||
extern long labs(long _j);
|
||||
extern ldiv_t ldiv(long _numer, long _denom);
|
||||
extern int mblen(const char *_s, size_t _n);
|
||||
extern int mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
|
||||
extern int wctomb(char *_s, wchar_t _wchar);
|
||||
extern size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
|
||||
extern size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
|
||||
|
||||
/* Extensions (not part of the standard) */
|
||||
|
||||
#define atof(n) strtod(n, (char **)NULL)
|
||||
#define atoi(n) ((int)strtol(n, (char **)NULL, 10))
|
||||
#define atol(n) strtol(n, (char **)NULL, 10)
|
||||
#define atoll(n) strtoll(n, (char **)NULL, 10)
|
||||
#define mblen(s, n) mbtowc((wchar_t *)0, s, n)
|
||||
|
||||
#endif
|
|
@ -33,6 +33,7 @@ extern double ceil(double _x);
|
|||
extern double fabs(double _x);
|
||||
extern double floor(double _x);
|
||||
|
||||
extern double hypot(double _x, double _y);
|
||||
extern double pow(double _x, double _y);
|
||||
|
||||
extern double frexp(double _x, int *_exp);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
<tgmath.h> -- simple version used by "gimplify"
|
||||
|
||||
last edit: 2007-02-12 D A Gwyn
|
||||
*/
|
||||
|
||||
/* XXX -- Can't be done right without compiler support; it *may* suffice to
|
||||
use automatic coercion to type double with the <math.h> prototypes. */
|
||||
|
||||
#include <math.h>
|
||||
#include <complex.h>
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* getpw - get a password from the password file
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
getpw(int uid, char buf[])
|
||||
{
|
||||
register FILE *pwf;
|
||||
register int ch, i;
|
||||
register char *bp;
|
||||
|
||||
pwf = fopen("/etc/passwd", "r");
|
||||
if (pwf == NULL) return(1);
|
||||
|
||||
for (;;) {
|
||||
bp = buf;
|
||||
while ((ch = getc(pwf)) != '\n') {
|
||||
if (ch == EOF) return 1;
|
||||
*bp++ = ch;
|
||||
}
|
||||
*bp++ = '\0';
|
||||
bp = buf;
|
||||
for (i = 2; i; i--) {
|
||||
while ((ch = *bp++) != ':') {
|
||||
if(ch = '\0') return 1;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while ((ch = *bp++) != ':') {
|
||||
if (ch < '0' || ch > '9') return 1;
|
||||
i = i * 10 + (ch - '0');
|
||||
}
|
||||
if (i == uid) return(0);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
|
@ -16,7 +16,7 @@ __fillbuf(register FILE *stream)
|
|||
|
||||
stream->_count = 0;
|
||||
if (fileno(stream) < 0) return EOF;
|
||||
if (io_testflag(stream, (_IOEOF | _IOERR ))) return EOF;
|
||||
if (io_testflag(stream, _IOEOF)) return EOF;
|
||||
if (!io_testflag(stream, _IOREAD)) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
!File: spec_arith.h
|
||||
/* describes internal compiler arithmetics */
|
||||
/*#define SPECIAL_ARITHMETICS /* something different from native long */
|
||||
/*#define UNSIGNED_ARITH unsigned arith /* when it is supported */
|
||||
|
||||
|
||||
!File: static.h
|
||||
|
|
|
@ -94,7 +94,3 @@
|
|||
#define USE_INSERT 1 /* use C_insertpart mechanism */
|
||||
|
||||
|
||||
!File: uns_arith.h
|
||||
/*#define UNSIGNED_ARITH unsigned arith /* when it is supported */
|
||||
|
||||
|
||||
|
|
|
@ -94,7 +94,3 @@
|
|||
/*#define USE_INSERT 1 /* use C_insertpart mechanism */
|
||||
|
||||
|
||||
!File: uns_arith.h
|
||||
/*#define UNSIGNED_ARITH unsigned arith /* when it is supported */
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
extern char *symbol2str();
|
||||
|
||||
#define arith_sign ((arith) (1L << (sizeof(arith) * 8 - 1)))
|
||||
#define arith_sign ((arith) 1 << (sizeof(arith) * 8 - 1))
|
||||
|
||||
#ifndef NOCROSS
|
||||
arith full_mask[MAXSIZE+1];/* full_mask[1] == 0xFF, full_mask[2] == 0xFFFF, .. */
|
||||
|
@ -117,49 +117,8 @@ divide(pdiv, prem)
|
|||
register arith o1 = *pdiv;
|
||||
register arith o2 = *prem;
|
||||
|
||||
#ifndef UNSIGNED_ARITH
|
||||
/* this is more of a problem than you might
|
||||
think on C compilers which do not have
|
||||
unsigned long.
|
||||
*/
|
||||
if (o2 & arith_sign) {/* o2 > max_arith */
|
||||
if (! (o1 >= 0 || o1 < o2)) {
|
||||
/* this is the unsigned test
|
||||
o1 < o2 for o2 > max_arith
|
||||
*/
|
||||
*prem = o2 - o1;
|
||||
*pdiv = 1;
|
||||
}
|
||||
else {
|
||||
*pdiv = 0;
|
||||
}
|
||||
}
|
||||
else { /* o2 <= max_arith */
|
||||
arith half, bit, hdiv, hrem, rem;
|
||||
|
||||
half = (o1 >> 1) & ~arith_sign;
|
||||
bit = o1 & 01;
|
||||
/* now o1 == 2 * half + bit
|
||||
and half <= max_arith
|
||||
and bit <= max_arith
|
||||
*/
|
||||
hdiv = half / o2;
|
||||
hrem = half % o2;
|
||||
rem = 2 * hrem + bit;
|
||||
*pdiv = 2*hdiv;
|
||||
*prem = rem;
|
||||
if (rem < 0 || rem >= o2) {
|
||||
/* that is the unsigned compare
|
||||
rem >= o2 for o2 <= max_arith
|
||||
*/
|
||||
*pdiv += 1;
|
||||
*prem -= o2;
|
||||
}
|
||||
}
|
||||
#else
|
||||
*pdiv = (UNSIGNED_ARITH) o1 / (UNSIGNED_ARITH) o2;
|
||||
*prem = (UNSIGNED_ARITH) o1 % (UNSIGNED_ARITH) o2;
|
||||
#endif
|
||||
*pdiv = (unsigned arith) o1 / (unsigned arith) o2;
|
||||
*prem = (unsigned arith) o1 % (unsigned arith) o2;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -200,22 +159,29 @@ cstibin(expp)
|
|||
break;
|
||||
|
||||
case DIV:
|
||||
case MOD:
|
||||
if (o2 == 0) {
|
||||
node_error(exp, exp->nd_symb == DIV ?
|
||||
"division by 0" :
|
||||
"modulo by 0");
|
||||
node_error(exp, "division by 0");
|
||||
return;
|
||||
}
|
||||
if ((o1 < 0) != (o2 < 0)) {
|
||||
if (o1 < 0) o1 = -o1;
|
||||
else o2 = -o2;
|
||||
if (exp->nd_symb == DIV) o1 = -((o1+o2-1)/o2);
|
||||
else o1 = ((o1+o2-1)/o2) * o2 - o1;
|
||||
o1 = -((o1+o2-1)/o2);
|
||||
}
|
||||
else {
|
||||
if (exp->nd_symb == DIV) o1 /= o2;
|
||||
else o1 %= o2;
|
||||
else o1 /= o2;
|
||||
break;
|
||||
|
||||
case MOD:
|
||||
if (o2 == 0) {
|
||||
node_error(exp, "modulo by 0");
|
||||
return;
|
||||
}
|
||||
{
|
||||
arith m = o1 % o2;
|
||||
if (m != 0 && (o1 < 0) != (o2 < 0))
|
||||
o1 = m + o2;
|
||||
else
|
||||
o1 = m;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@ arith
|
|||
pointer_size = SZ_POINTER;
|
||||
#endif
|
||||
|
||||
#define arith_sign ((arith) (1L << (sizeof(arith) * 8 - 1)))
|
||||
|
||||
arith ret_area_size;
|
||||
|
||||
t_type
|
||||
|
@ -306,14 +304,7 @@ chk_bounds(l1, l2, fund)
|
|||
if (fund == T_INTEGER) {
|
||||
return l2 >= l1;
|
||||
}
|
||||
#ifdef UNSIGNED_ARITH
|
||||
return (UNSIGNED_ARITH) l2 >= (UNSIGNED_ARITH) l1;
|
||||
#else
|
||||
return (l2 & arith_sign ?
|
||||
(l1 & arith_sign ? l2 >= l1 : 1) :
|
||||
(l1 & arith_sign ? 0 : l2 >= l1)
|
||||
);
|
||||
#endif
|
||||
return (unsigned arith) l2 >= (unsigned arith) l1;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -19,7 +19,7 @@ IMPLEMENTATION MODULE Terminal;
|
|||
#else
|
||||
FROM Unix IMPORT read, write, open, ioctl;
|
||||
#endif
|
||||
VAR fildes: INTEGER;
|
||||
VAR fildes, fdout: INTEGER;
|
||||
unreadch: CHAR;
|
||||
unread: BOOLEAN;
|
||||
tty: ARRAY[0..8] OF CHAR;
|
||||
|
@ -87,7 +87,7 @@ IMPLEMENTATION MODULE Terminal;
|
|||
|
||||
PROCEDURE Write(ch: CHAR);
|
||||
BEGIN
|
||||
IF write(fildes, ADR(ch), 1) < 0 THEN
|
||||
IF write(fdout, ADR(ch), 1) < 0 THEN
|
||||
;
|
||||
END;
|
||||
END Write;
|
||||
|
@ -114,7 +114,9 @@ BEGIN
|
|||
unread := FALSE;
|
||||
*)
|
||||
(* dtrg: changed so that instead of opening /dev/tty, fd 0 is always used. *)
|
||||
(* kernigh: sent output to fd 1 *)
|
||||
tty := "stdio";
|
||||
fildes := 0;
|
||||
fdout := 1;
|
||||
unread := FALSE;
|
||||
END Terminal.
|
||||
|
|
|
@ -43,26 +43,28 @@ int
|
|||
rmi(j,i)
|
||||
int j,i;
|
||||
{
|
||||
int m;
|
||||
|
||||
if (j == 0) TRP(EIDIVZ);
|
||||
if (i == 0) return 0;
|
||||
if ((i < 0) != (j < 0)) {
|
||||
if (i < 0) i = -i;
|
||||
else j = -j;
|
||||
return j*((i+j-1)/j)-i;
|
||||
}
|
||||
else return i%j;
|
||||
|
||||
m = i % j;
|
||||
if (m != 0 && (i < 0) != (j < 0))
|
||||
m += j;
|
||||
return m;
|
||||
}
|
||||
|
||||
long
|
||||
rmil(j,i)
|
||||
long j,i;
|
||||
{
|
||||
long m;
|
||||
|
||||
if (j == 0) TRP(EIDIVZ);
|
||||
if (i == 0) return 0L;
|
||||
if ((i < 0) != (j < 0)) {
|
||||
if (i < 0) i = -i;
|
||||
else j = -j;
|
||||
return j*((i+j-1)/j)-i;
|
||||
}
|
||||
else return i%j;
|
||||
|
||||
m = i % j;
|
||||
if (m != 0 && (i < 0) != (j < 0))
|
||||
m += j;
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ name cem
|
|||
callname cc
|
||||
end
|
||||
name pc
|
||||
from .p
|
||||
from .p.pas
|
||||
to .k
|
||||
program {EM}/lib/ack/em_pc
|
||||
mapflag -L PC_F={PC_F?} -L
|
||||
|
|
49
tests/plat/bugs/bug-62-notvar_var_e.c
Normal file
49
tests/plat/bugs/bug-62-notvar_var_e.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include "test.h"
|
||||
|
||||
/*
|
||||
* Function a() comes from this mail by Rune to tack-devel:
|
||||
* https://sourceforge.net/p/tack/mailman/message/35809953/
|
||||
*
|
||||
* The peephole optimiser (util/opt) had a bug that rewrote
|
||||
* xx(! i, i) as xx(1). It was confused with xx(i == i).
|
||||
*/
|
||||
|
||||
void xx(int xfal, int x1234) {
|
||||
ASSERT(xfal == 0);
|
||||
ASSERT(x1234 == 1234);
|
||||
}
|
||||
|
||||
void a(void) {
|
||||
int i = 1234;
|
||||
xx(! i, i);
|
||||
}
|
||||
|
||||
void xxxx(int x2005, int xfal, int xn567, int x2017) {
|
||||
ASSERT(x2005 == 2005);
|
||||
ASSERT(xfal == 0);
|
||||
ASSERT(xn567 == -567);
|
||||
ASSERT(x2017 == 2017);
|
||||
}
|
||||
|
||||
/* Like a(), but with surrounding arguments. */
|
||||
void b(void) {
|
||||
int i = -567;
|
||||
xxxx(2005, ! i, i, 2017);
|
||||
}
|
||||
|
||||
/*
|
||||
* In c(), the fixed peephole optimiser may
|
||||
* rewrite i == i as 1 and i != i as 0.
|
||||
*/
|
||||
void c(int i, int tru, int fal) {
|
||||
ASSERT((i == i) == tru);
|
||||
ASSERT((i != i) == fal);
|
||||
}
|
||||
|
||||
/* Bypasses the CRT. */
|
||||
void _m_a_i_n(void) {
|
||||
a();
|
||||
b();
|
||||
c(62, 1, 0);
|
||||
finished();
|
||||
}
|
|
@ -13,7 +13,8 @@ definerule("plat_testsuite",
|
|||
"tests/plat/*.e",
|
||||
"tests/plat/*.p",
|
||||
"tests/plat/b/*.b",
|
||||
"tests/plat/bugs/*.mod"
|
||||
"tests/plat/bugs/bug-22-inn_mod.mod",
|
||||
"tests/plat/bugs/bug-62-notvar_var_e.c"
|
||||
)
|
||||
|
||||
acklibrary {
|
||||
|
|
|
@ -38,7 +38,7 @@ finally combining the results into a single file.
|
|||
.PP
|
||||
Different machines can use different suffices,
|
||||
but the following are recognized by most machines:
|
||||
.IP .p
|
||||
.IP ".p .pas"
|
||||
Pascal program.
|
||||
.IP .c
|
||||
C module.
|
||||
|
@ -395,7 +395,7 @@ l l l l.
|
|||
input:name:output:description
|
||||
\&.f:f77:.c:Fortran-to-C front end
|
||||
\&.c:cem:.k:C front end [4,5,6]
|
||||
\&.p:pc:.k:Pascal front end [2,3,6]
|
||||
\&.p .pas:pc:.k:Pascal front end [2,3,6]
|
||||
\&.b:basic:.k:Basic front end [6,8]
|
||||
\&.ocm:ocm:.k:Occam front end [9]
|
||||
\&.mod:m2:.k:Modula-2 front end [11]
|
||||
|
|
|
@ -346,7 +346,7 @@ int main(int argc, char* argv[])
|
|||
opterr = 0;
|
||||
for (;;)
|
||||
{
|
||||
int opt = getopt(argc, argv, "-M:P:O:vt");
|
||||
int opt = getopt(argc, argv, "M:P:O:vt");
|
||||
if (opt == -1)
|
||||
break;
|
||||
|
||||
|
@ -364,17 +364,14 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
int o = atoi(optarg);
|
||||
if (o <= 2)
|
||||
break;
|
||||
if (o <= 3)
|
||||
Ophase = &O2phases[0];
|
||||
else if (o == 3)
|
||||
Ophase = &O3phases[0];
|
||||
Ophase = &O4phases[0];
|
||||
else
|
||||
Ophase = &O4phases[0];
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
add_file(optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
keeptemps = 1;
|
||||
goto addopt;
|
||||
|
@ -390,6 +387,9 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
for (i = optind; i < argc; i++)
|
||||
add_file(argv[i]);
|
||||
|
||||
phase_args[nphase_args] = 0;
|
||||
if (nuphases)
|
||||
Ophase = uphases;
|
||||
|
|
|
@ -17,6 +17,7 @@ cprogram {
|
|||
matching(filenamesof("+flex"), "%.c$"),
|
||||
},
|
||||
deps = {
|
||||
"./*.h",
|
||||
"+flex",
|
||||
"+yacc",
|
||||
"modules/src/em_data+lib",
|
||||
|
|
|
@ -87,7 +87,7 @@ pattern :
|
|||
if (patCBO) {
|
||||
register int i;
|
||||
|
||||
if (! rplCBO) {
|
||||
if (! rplCBO) {
|
||||
yyerror("No CBO in replacement");
|
||||
}
|
||||
for (i=0; i<sizeof(CBO_instrs)/sizeof(int); i++) {
|
||||
|
@ -153,8 +153,7 @@ optexpr : /* empty */
|
|||
{ $$ = 0; }
|
||||
| expr
|
||||
;
|
||||
expr
|
||||
: '$' argno
|
||||
expr : '$' argno
|
||||
{ $$ = lookup(0,EX_ARG,$2,0); }
|
||||
| NUMBER
|
||||
{ $$ = lookup(0,EX_CON,(int)(short)$1,0); }
|
||||
|
@ -382,25 +381,26 @@ outpat(exprno, instrno)
|
|||
{
|
||||
register int i;
|
||||
|
||||
outbyte(0); outshort(prevind); prevind=curind-3;
|
||||
out(patlen);
|
||||
for (i=0;i<patlen;i++) {
|
||||
outbyte(0); outshort(prevind); prevind=curind-3;
|
||||
out(patlen);
|
||||
for (i=0;i<patlen;i++) {
|
||||
if (patmnem[i] == op_CBO) outbyte(instrno);
|
||||
else outbyte(patmnem[i]);
|
||||
}
|
||||
out(exprno);
|
||||
out(rpllen);
|
||||
for (i=0;i<rpllen;i++) {
|
||||
out(exprno);
|
||||
out(rpllen);
|
||||
for (i=0;i<rpllen;i++) {
|
||||
if (rplmnem[i] == op_CBO) outbyte(instrno);
|
||||
else outbyte(rplmnem[i]);
|
||||
out(rplexpr[i]);
|
||||
}
|
||||
}
|
||||
#ifdef DIAGOPT
|
||||
outshort(patno);
|
||||
/* outshort(patno); */
|
||||
outshort(lino - 1);
|
||||
#endif
|
||||
patno++;
|
||||
printf("\n");
|
||||
if (patlen>maxpatlen) maxpatlen=patlen;
|
||||
patno++;
|
||||
printf("\n");
|
||||
if (patlen>maxpatlen) maxpatlen=patlen;
|
||||
}
|
||||
|
||||
outbyte(b) {
|
||||
|
@ -424,4 +424,3 @@ out(w) {
|
|||
outshort(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -641,13 +641,13 @@ lol lol bne $1==$2 :
|
|||
loe loe bne $1==$2 :
|
||||
lil lil bne $1==$2 :
|
||||
|
||||
lol lol teq $1==$2 : loc 1
|
||||
loe loe teq $1==$2 : loc 1
|
||||
lil lil teq $1==$2 : loc 1
|
||||
lol lol cms teq $1==$2 && $3==w : loc 1
|
||||
loe loe cms teq $1==$2 && $3==w : loc 1
|
||||
lil lil cms teq $1==$2 && $3==w : loc 1
|
||||
|
||||
lol lol tne $1==$2 : loc 0
|
||||
loe loe tne $1==$2 : loc 0
|
||||
lil lil tne $1==$2 : loc 0
|
||||
lol lol cms tne $1==$2 && $3==w : loc 0
|
||||
loe loe cms tne $1==$2 && $3==w : loc 0
|
||||
lil lil cms tne $1==$2 && $3==w : loc 0
|
||||
|
||||
lol loc CBO stl $3==w && $1==$4 : loc $2 lol $1 CBO w stl $4
|
||||
lol loe CBO stl $3==w && $1==$4 : loe $2 lol $1 CBO w stl $4
|
||||
|
|
Loading…
Reference in a new issue