Compare commits

..

No commits in common. "318a675ea69156180465edf92dc62751019457e6" and "665ca8e32de99933cf453221b63ffe826a6091f1" have entirely different histories.

3 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ echo ">>>>>> Running $demo with the Python interpreter"
./interpret_demo.py "$demo" > interpreted.log ./interpret_demo.py "$demo" > interpreted.log
echo "...... Trying NAC3's 32-bit code generator output" echo "...... Trying NAC3's 32-bit code generator output"
./run_demo.sh -i386 --out run_32.log "${nac3args[@]}" "$demo" ./run_demo.sh -m32 --out run_32.log "${nac3args[@]}" "$demo"
diff -Nau interpreted.log run_32.log diff -Nau interpreted.log run_32.log
echo "...... Trying NAC3's 64-bit code generator output" echo "...... Trying NAC3's 64-bit code generator output"

View File

@ -6,6 +6,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define usize size_t
double dbl_nan(void) { double dbl_nan(void) {
return NAN; return NAN;
} }
@ -62,14 +64,14 @@ void output_asciiart(int32_t x) {
struct cslice { struct cslice {
void *data; void *data;
size_t len; uint32_t len;
}; };
void output_int32_list(struct cslice *slice) { void output_int32_list(struct cslice *slice) {
const int32_t *data = (int32_t *) slice->data; const int32_t *data = (int32_t *) slice->data;
putchar('['); putchar('[');
for (size_t i = 0; i < slice->len; ++i) { for (uint32_t i = 0; i < slice->len; ++i) {
if (i == slice->len - 1) { if (i == slice->len - 1) {
printf("%d", data[i]); printf("%d", data[i]);
} else { } else {
@ -83,7 +85,7 @@ void output_int32_list(struct cslice *slice) {
void output_str(struct cslice *slice) { void output_str(struct cslice *slice) {
const char *data = (const char *) slice->data; const char *data = (const char *) slice->data;
for (size_t i = 0; i < slice->len; ++i) { for (uint32_t i = 0; i < slice->len; ++i) {
putchar(data[i]); putchar(data[i]);
} }
} }

View File

@ -11,7 +11,7 @@ declare -a nac3args
while [ $# -ge 1 ]; do while [ $# -ge 1 ]; do
case "$1" in case "$1" in
--help) --help)
echo "Usage: run_demo.sh [--help] [--out OUTFILE] [--debug] [-i386] -- [NAC3ARGS...]" echo "Usage: run_demo.sh [--help] [--out OUTFILE] [--debug] [-m32] -- [NAC3ARGS...]"
exit exit
;; ;;
--out) --out)
@ -21,8 +21,8 @@ while [ $# -ge 1 ]; do
--debug) --debug)
debug=1 debug=1
;; ;;
-i386) -m32)
i386=1 m32=1
;; ;;
--) --)
shift shift
@ -51,7 +51,7 @@ fi
rm -f ./*.o ./*.bc demo rm -f ./*.o ./*.bc demo
if [ -z "$i386" ]; then if [ -z "$m32" ]; then
$nac3standalone "${nac3args[@]}" $nac3standalone "${nac3args[@]}"
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c