commit
fed3179d3b
77 changed files with 782 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,5 +8,6 @@
|
|||
/mou/
|
||||
/ser/
|
||||
/targetutil/
|
||||
/testwrk/
|
||||
/tgi/
|
||||
/wrk/
|
||||
|
|
1
test/.gitignore
vendored
Normal file
1
test/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.o
|
52
test/Makefile
Normal file
52
test/Makefile
Normal file
|
@ -0,0 +1,52 @@
|
|||
|
||||
# toplevel makefile for the regression tests
|
||||
|
||||
MAKE := make --no-print-dir
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
EXE := .exe
|
||||
MKDIR = mkdir
|
||||
RMDIR = rmdir
|
||||
else
|
||||
RM := rm -f
|
||||
EXE :=
|
||||
MKDIR = mkdir -p
|
||||
RMDIR = rmdir
|
||||
endif
|
||||
|
||||
WORKDIR := ../testwrk
|
||||
|
||||
.PHONY: dotests clean
|
||||
|
||||
all: dotests
|
||||
|
||||
$(WORKDIR):
|
||||
@$(MKDIR) $(WORKDIR)
|
||||
|
||||
$(WORKDIR)/bdiff$(EXE): $(WORKDIR)
|
||||
@$(CC) -o $(WORKDIR)/bdiff$(EXE) bdiff.c
|
||||
|
||||
dotests: $(WORKDIR)/bdiff$(EXE)
|
||||
@$(MAKE) -C val clean all
|
||||
@$(MAKE) -C ref clean all
|
||||
@$(MAKE) -C err clean all
|
||||
@$(MAKE) -C misc clean all
|
||||
|
||||
continue: $(WORKDIR)/bdiff$(EXE)
|
||||
@$(MAKE) -C val all
|
||||
@$(MAKE) -C ref all
|
||||
@$(MAKE) -C err all
|
||||
@$(MAKE) -C misc all
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C val clean
|
||||
@$(MAKE) -C ref clean
|
||||
@$(MAKE) -C err clean
|
||||
@$(MAKE) -C misc clean
|
||||
@$(RM) $(WORKDIR)/bdiff$(EXE)
|
||||
@$(RMDIR) $(WORKDIR)
|
28
test/bdiff.c
Normal file
28
test/bdiff.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
// minimal tool to compare two binaries
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f1, *f2;
|
||||
if (argc < 3) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
f1 = fopen(argv[1], "rb");
|
||||
f2 = fopen(argv[2], "rb");
|
||||
if ((f1 == NULL) || (f2 == NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for(;;) {
|
||||
if (feof(f1) && feof(f2)) {
|
||||
return EXIT_SUCCESS;
|
||||
} else if (feof(f1) || feof(f2)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (fgetc(f1) != fgetc(f2)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
52
test/err/Makefile
Normal file
52
test/err/Makefile
Normal file
|
@ -0,0 +1,52 @@
|
|||
|
||||
# makefile for the tests that MUST NOT compile
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.prg: %.c
|
||||
! $(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.o.prg: %.c
|
||||
! $(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.os.prg: %.c
|
||||
! $(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osi.prg: %.c
|
||||
! $(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osir.prg: %.c
|
||||
! $(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oi.prg: %.c
|
||||
! $(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oir.prg: %.c
|
||||
! $(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.or.prg: %.c
|
||||
! $(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
67
test/misc/Makefile
Normal file
67
test/misc/Makefile
Normal file
|
@ -0,0 +1,67 @@
|
|||
|
||||
# makefile for the remaining tests that need special care in one way or another
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
DIFF := $(WORKDIR)/bdiff
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
# FIXME: actually use/build differently optimized programs here
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
# should compile, but then hangs in an endless loop
|
||||
$(WORKDIR)/endless%prg: endless.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
! $(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
# these need reference data that cant be generated by a host compiled program
|
||||
# in a useful way
|
||||
$(WORKDIR)/limits%prg: limits.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out
|
||||
$(DIFF) $(WORKDIR)/limits.out limits.ref
|
||||
|
||||
# the rest are tests that fail currently for one reason or another
|
||||
$(WORKDIR)/fields%prg: fields.c
|
||||
@echo "FIXME: " $@ "will currently fail"
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
-$(SIM65) $(SIM65FLAGS) $@
|
||||
$(WORKDIR)/sitest%prg: sitest.c
|
||||
@echo "FIXME: " $@ "will currently fail"
|
||||
-$(CL65) $(CC65FLAGS) $< -o $@
|
||||
-$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
|
||||
|
||||
|
22
test/misc/common.h
Normal file
22
test/misc/common.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
13
test/misc/endless.c
Normal file
13
test/misc/endless.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("entering endless loop\n");
|
||||
for(;;) {
|
||||
;
|
||||
}
|
||||
printf("error: should not come here\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef NO_BITFIELDS
|
||||
|
||||
main()
|
24
test/misc/limits.ref
Normal file
24
test/misc/limits.ref
Normal file
|
@ -0,0 +1,24 @@
|
|||
CHAR_MAX: 0x000000ff=255
|
||||
UCHAR_MAX: 0x000000ff=255
|
||||
SCHAR_MAX: 0x0000007f=127
|
||||
SHRT_MAX: 0x00007fff=32767
|
||||
USHRT_MAX: 0x0000ffff=-1
|
||||
SSHRT_MAX: 0x00007fff=32767
|
||||
INT_MAX: 0x00007fff=32767
|
||||
UINT_MAX: 0x0000ffff=-1
|
||||
SINT_MAX: 0x00007fff=32767
|
||||
LONG_MAX: 0x7fffffff=2147483647
|
||||
ULONG_MAX: 0xffffffff=-1
|
||||
SLONG_MAX: 0x7fffffff=2147483647
|
||||
CHAR_MIN: 0x00000000=0
|
||||
UCHAR_MIN: 0x00000000=0
|
||||
SCHAR_MIN: 0x0000ff80=-128
|
||||
SHRT_MIN: 0x00008000=-32768
|
||||
USHRT_MIN: 0x00000000=0
|
||||
SSHRT_MIN: 0x00008000=-32768
|
||||
INT_MIN: 0x00008000=-32768
|
||||
UINT_MIN: 0x00000000=0
|
||||
SINT_MIN: 0x00008000=-32768
|
||||
LONG_MIN: 0x80000000=-2147483648
|
||||
ULONG_MIN: 0x00000000=0
|
||||
SLONG_MIN: 0x80000000=-2147483648
|
25
test/readme.txt
Normal file
25
test/readme.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
This directory contains test code for automatic regression testing of the CC65
|
||||
compiler.
|
||||
|
||||
|
||||
/val - the bulk of tests are contained here, individual tests should exit with
|
||||
an exit code of EXIT_SUCCESS when they pass, or EXIT_FAILURE on error
|
||||
|
||||
/ref - these tests produce output that must be compared with reference output
|
||||
|
||||
/err - contains tests that MUST NOT compile
|
||||
|
||||
/misc - a few tests that need special care of some sort
|
||||
|
||||
|
||||
to run the tests use "make" in this (top) directory, the makefile should exit
|
||||
with no error.
|
||||
|
||||
when a test failed you can use "make continue" to run further tests
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
TODO:
|
||||
|
||||
- reduce usage of "common.h" to a minimum
|
||||
- convert more tests from using reference output to returning an exit code
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int up[15], down[15], rows[8], x[8];
|
||||
void queens(int c);
|
||||
void print(void);
|
||||
|
|
92
test/ref/Makefile
Normal file
92
test/ref/Makefile
Normal file
|
@ -0,0 +1,92 @@
|
|||
|
||||
# makefile for the regression tests that generate output which has to be
|
||||
# compared with reference output
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
DIFF := $(WORKDIR)/bdiff
|
||||
|
||||
CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c))
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(REFS) $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.ref: %.c
|
||||
$(CC) $(CFLAGS) $< -o $(WORKDIR)/$*.host
|
||||
$(WORKDIR)/$*.host > $@
|
||||
|
||||
$(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.os.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.osi.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.osir.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.oi.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.oir.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host)
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
long a; /* must be static life */
|
||||
long b; /* must be static life */
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ optimizations. If I remove the struct inside f() it compiles fine ?!?
|
|||
Best, Oliver
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void f(void){struct{int i;}d;}
|
||||
struct{void(*p)(void);}s={f};
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
cc65 doesn't compile this, if i use the "-O"-option.
|
||||
but it works with "while(!0)"; instead of "for(;;);"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
there is a bug in the preprocessor (i think) ... the following works
|
||||
(compiles) correctly:
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct Record {
|
||||
struct Record *PtrComp;
|
||||
int x;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!! Oliver Schmidt
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
After spending a "little" time I finally succeeded in isolating an
|
||||
(maybe THE) optimizer bug causing Contiki to fail.
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int foo=0,bar=2;
|
||||
|
||||
int main(void)
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
This produces the compiler error "test.c(9): Error: Assignment to const"
|
||||
Shouldn't be an error, should it? baz is const, bar isn't.
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
...gives "test.c(2): Error: Variable `foo' has unknown size" using -Cl.
|
||||
Is it really unknown?
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
test2 and test3 will result in an endless loop (SVN version: 4974M)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define OPENTEST()
|
||||
#define CLOSETEST()
|
||||
|
||||
|
|
|
@ -8,11 +8,16 @@
|
|||
cf - print character frequencies
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
FILE *in;
|
||||
|
||||
#define INFILE "cf.in"
|
||||
#define GETCHAR() fgetc(in)
|
||||
|
||||
#ifndef NO_FLOATS
|
||||
float f[0x100];
|
||||
|
@ -35,6 +40,11 @@ char *argv[];
|
|||
signed cutoff;
|
||||
#endif
|
||||
|
||||
in = fopen(INFILE, "rb");
|
||||
if (in == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (argc <= 1)
|
||||
#ifndef NO_FLOATS
|
||||
cutoff = 0.0;
|
||||
|
@ -176,6 +186,6 @@ char *argv[];
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
|
19
test/ref/cf.in
Executable file
19
test/ref/cf.in
Executable file
|
@ -0,0 +1,19 @@
|
|||
start cf.input >
|
||||
The sky above the port was the color of television, tuned
|
||||
to a dead channel.
|
||||
"It's not like I'm using," Case heard someone say, as he
|
||||
shouldered his way through the crowd around the door of the
|
||||
Chat. "It's like my body's developed this massive drug deficiency."
|
||||
It was a Sprawl voice and a Sprawl joke. The Chatsubo
|
||||
was a bar for professional expatriates; you could drink there
|
||||
for a week and never hear two words in Japanese.
|
||||
Ratz was tending bar, his prosthetic arm jerking monotonously
|
||||
as he filled a tray of glasses with draft Kirin. He saw
|
||||
Case and smiled, his teeth a web work of East European steel
|
||||
and brown decay. Case found a place at the bar, between the
|
||||
unlikely tan on one of Lonny Zone's whores and the crisp naval
|
||||
uniform of a tall African whose cheekbones were ridged with
|
||||
Joe boys," Ratz said, shoving a draft across the bar with his
|
||||
good hand. "Maybe some business with you, Case?"
|
||||
Case shrugged. The girl to his right giggled and nudged
|
||||
< end cf.input
|
|
@ -4,6 +4,7 @@
|
|||
!!LICENCE!! Public Domain
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
|
22
test/ref/common.h
Normal file
22
test/ref/common.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
|
@ -4,6 +4,9 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
signed char c;
|
||||
signed short s;
|
||||
signed int i;
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
/* todo: add back conditional stuff here ! */
|
||||
|
||||
typedef struct { int codes[3]; char name[6]; } Word;
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
||||
#ifdef NO_OLD_FUNC_DECL
|
||||
f();
|
||||
void g(Word *p);
|
||||
|
@ -42,8 +43,8 @@ Word words[] = {
|
|||
|
||||
/*int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } };*/
|
||||
int x[][5] = { {1, 2, 3, 4, 0 }, { 5, 6 }, { 7 } };
|
||||
int *y[] = { x[0], x[1], x[2], 0 };
|
||||
|
||||
int *y[] = { x[0], x[1], x[2], 0 };
|
||||
|
||||
main()
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!! Groepaz/Hitmen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#if 1
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! GPL (?), read COPYING.GPL
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* Sample OTCC C example. You can uncomment the first line and install
|
||||
* otcc in /usr/local/bin to make otcc scripts !
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef NO_FLOATS
|
||||
|
||||
main()
|
||||
{
|
||||
printf("NO_FLOATS\n\r");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
!!LICENCE!! public domain
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
@ -101,11 +102,11 @@ static void test30(void)
|
|||
cc65 seems to have problems here aswell ;/
|
||||
*/
|
||||
|
||||
int main(void) {
|
||||
int main(void) {
|
||||
test1();
|
||||
test2();
|
||||
test30();
|
||||
test31();
|
||||
/* test32(); */
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef NO_FUNCS_TAKE_STRUCTS
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct point { int x,y; } point;
|
||||
typedef struct rect { point pt1, pt2; } rect;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#define MAXWORDS 250
|
||||
|
||||
FILE *in;
|
||||
#define getchar() fgetc(in)
|
||||
|
||||
struct node
|
||||
{
|
||||
int count; /* frequency count */
|
||||
|
@ -122,11 +125,17 @@ int main(void)
|
|||
struct node *root;
|
||||
char word[20];
|
||||
|
||||
in = fopen("wf1.in","rb");
|
||||
if (in == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
root = 0;
|
||||
next = 0;
|
||||
while (getword(word))
|
||||
lookup(word, &root)->count++;
|
||||
tprint(root);
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
|
17
test/ref/wf1.in
Normal file
17
test/ref/wf1.in
Normal file
|
@ -0,0 +1,17 @@
|
|||
The sky above the port was the color of television, tuned
|
||||
to a dead channel.
|
||||
"It's not like I'm using," Case heard someone say, as he
|
||||
shouldered his way through the crowd around the door of the
|
||||
Chat. "It's like my body's developed this massive drug deficiency."
|
||||
It was a Sprawl voice and a Sprawl joke. The Chatsubo
|
||||
was a bar for professional expatriates; you could drink there
|
||||
for a week and never hear two words in Japanese.
|
||||
Ratz was tending bar, his prosthetic arm jerking monotonously
|
||||
as he filled a tray of glasses with draft Kirin. He saw
|
||||
Case and smiled, his teeth a web work of East European steel
|
||||
and brown decay. Case found a place at the bar, between the
|
||||
unlikely tan on one of Lonny Zone's whores and the crisp naval
|
||||
uniform of a tall African whose cheekbones were ridged with
|
||||
Joe boys," Ratz said, shoving a draft across the bar with his
|
||||
good hand. "Maybe some business with you, Case?"
|
||||
Case shrugged. The girl to his right giggled and nudged
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
/*#define STANDALONE*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef YACCDBG
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -19,6 +21,9 @@
|
|||
|
||||
#endif
|
||||
|
||||
FILE *infile, *outfile;
|
||||
#define getchar() fgetc(infile)
|
||||
|
||||
/* hack the original tables to work with both petscii and ascii */
|
||||
#define CHARSETHACK
|
||||
|
||||
|
@ -61,7 +66,6 @@ int yymorfg;
|
|||
extern char *yysptr, yysbuf[];
|
||||
int yytchar;
|
||||
|
||||
/*FILE *yyin ={stdin}, *yyout ={stdout};*/
|
||||
#define yyin infile
|
||||
#define yyout outfile
|
||||
|
||||
|
@ -665,7 +669,13 @@ yyunput(c)
|
|||
main()
|
||||
{
|
||||
printf("main start\n");
|
||||
infile = fopen("yacc.in","rb");
|
||||
if (infile == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
outfile = stdout;
|
||||
yyparse();
|
||||
fclose(infile);
|
||||
printf("main end\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
3
test/ref/yacc.in
Executable file
3
test/ref/yacc.in
Executable file
|
@ -0,0 +1,3 @@
|
|||
x=(e+1)*3/(3+7)
|
||||
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
!!AUTHOR!! Groepaz/Hitmen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
# define YYTYPE char
|
||||
struct yywork
|
||||
{
|
||||
|
|
70
test/val/Makefile
Normal file
70
test/val/Makefile
Normal file
|
@ -0,0 +1,70 @@
|
|||
|
||||
# makefile for the regression tests that return an error code on failure
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.prg: %.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.o.prg: %.c
|
||||
$(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.os.prg: %.c
|
||||
$(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.osi.prg: %.c
|
||||
$(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.osir.prg: %.c
|
||||
$(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.oi.prg: %.c
|
||||
$(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.oir.prg: %.c
|
||||
$(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.or.prg: %.c
|
||||
$(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
BIN
test/val/add1.o
BIN
test/val/add1.o
Binary file not shown.
Binary file not shown.
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! GPL, read COPYING.GPL
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
|
BIN
test/val/add3.o
BIN
test/val/add3.o
Binary file not shown.
Binary file not shown.
BIN
test/val/add4.o
BIN
test/val/add4.o
Binary file not shown.
Binary file not shown.
|
@ -5,6 +5,7 @@
|
|||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct {
|
||||
|
|
22
test/val/common.h
Normal file
22
test/val/common.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
|
@ -17,9 +17,6 @@ unsigned char success = 0;
|
|||
unsigned char failures = 0;
|
||||
unsigned char dummy = 0;
|
||||
|
||||
#ifdef SUPPORT_BIT_TYPES
|
||||
bit bit0 = 0;
|
||||
#endif
|
||||
int int0 = 0;
|
||||
int int1 = 0;
|
||||
char char0 = 0;
|
||||
|
@ -291,19 +288,16 @@ void c_minus1(void)
|
|||
printf("(long0 != -1)\n");
|
||||
if(long0 != -1)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
printf("(long0 > 0)\n");
|
||||
if(long0 > 0)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
printf("(long1 < 0)\n");
|
||||
if(long1 < 0)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef CQ26_INCLUDED
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
|
|
129
test/val/cq4.c
129
test/val/cq4.c
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -41,7 +43,124 @@ struct defs {
|
|||
int crc; /* Cumulative return code */
|
||||
char rfs[8]; /* Return from section */
|
||||
|
||||
/*#include "cq26.c"*/ /* hardware check */
|
||||
#define CQ26_INCLUDED
|
||||
/*
|
||||
section s26, which pokes around at the hardware
|
||||
trying to figure out the characteristics of the machine that
|
||||
it is running on, saves information that is subsequently
|
||||
used by sections s626, s72, and s757. If this program is
|
||||
to be broken up into smallish pieces, say for running on
|
||||
a microcomputer, take care to see that s26 is called before
|
||||
calling any of the latter three sections.
|
||||
*/
|
||||
|
||||
/*
|
||||
2.6 Hardware Characteristics
|
||||
*/
|
||||
|
||||
#ifndef NO_OLD_FUNC_DECL
|
||||
s26(pd0)
|
||||
struct defs *pd0;
|
||||
{
|
||||
#else
|
||||
s26(struct defs *pd0) {
|
||||
#endif
|
||||
static char qs26[8] = "s26 ";
|
||||
char *ps, *pt;
|
||||
char c0, c1;
|
||||
#ifndef NO_FLOATS
|
||||
float temp, one, delta;
|
||||
double tempd, oned;
|
||||
#endif
|
||||
static char s[] = "%3d bits in %ss.\n";
|
||||
static char s2[] = "%e is the least number that can be added to 1. (%s).\n";
|
||||
|
||||
ps = qs26;
|
||||
pt = pd0->rfs;
|
||||
|
||||
while(*pt++ = *ps++);
|
||||
|
||||
/* Here, we shake the machinery a little to see what falls
|
||||
out. First, we find out how many bits are in a char. */
|
||||
|
||||
pd0->cbits = 0;
|
||||
c0 = 0;
|
||||
c1 = 1;
|
||||
|
||||
while(c0 != c1) {
|
||||
c1 = c1<<1;
|
||||
pd0->cbits = pd0->cbits+1;
|
||||
}
|
||||
/* That information lets us determine the size of everything else. */
|
||||
|
||||
pd0->ibits = pd0->cbits * sizeof(int);
|
||||
pd0->sbits = pd0->cbits * sizeof(short);
|
||||
pd0->lbits = pd0->cbits * sizeof(long);
|
||||
pd0->ubits = pd0->cbits * sizeof(unsigned);
|
||||
#ifndef NO_FLOATS
|
||||
pd0->fbits = pd0->cbits * sizeof(float);
|
||||
pd0->dbits = pd0->cbits * sizeof(double);
|
||||
#endif
|
||||
|
||||
/* We have now almost reconstructed the table in section 2.6, the
|
||||
exception being the range of the floating point hardware.
|
||||
Now there are just so many ways to conjure up a floating point
|
||||
representation system that it's damned near impossible to guess
|
||||
what's going on by writing a program to interpret bit patterns.
|
||||
Further, the information isn't all that useful, if we consider
|
||||
the fact that machines that won't handle numbers between 10**30
|
||||
and 10**-30 are very hard to find, and that people playing with
|
||||
numbers outside that range have a lot more to worry about than
|
||||
just the capacity of the characteristic.
|
||||
|
||||
A much more useful measure is the precision, which can be ex-
|
||||
pressed in terms of the smallest number that can be added to
|
||||
1. without loss of significance. We calculate that here, for
|
||||
float and double. */
|
||||
|
||||
#ifndef NO_FLOATS
|
||||
one = 1.;
|
||||
delta = 1.;
|
||||
temp = 0.;
|
||||
while(temp != one) {
|
||||
temp = one+delta;
|
||||
delta = delta/2.;
|
||||
}
|
||||
pd0->fprec = delta * 4.;
|
||||
oned = 1.;
|
||||
delta = 1.;
|
||||
tempd = 0.;
|
||||
while(tempd != oned) {
|
||||
tempd = oned+delta;
|
||||
delta = delta/2.;
|
||||
}
|
||||
pd0->dprec = delta * 4.;
|
||||
#endif
|
||||
|
||||
/* Now, if anyone's interested, we publish the results. */
|
||||
|
||||
#ifndef CQ26_INCLUDED
|
||||
if(pd0->flgm != 0) {
|
||||
printf(s,pd0->cbits,"char");
|
||||
printf(s,pd0->ibits,"int");
|
||||
printf(s,pd0->sbits,"short");
|
||||
printf(s,pd0->lbits,"long");
|
||||
printf(s,pd0->ubits,"unsigned");
|
||||
printf(s,pd0->fbits,"float");
|
||||
printf(s,pd0->dbits,"double");
|
||||
#ifndef NO_FLOATS
|
||||
printf(s2,pd0->fprec,"float");
|
||||
printf(s2,pd0->dprec,"double");
|
||||
#else
|
||||
printf("NO_FLOATS\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/* Since we are only exploring and perhaps reporting, but not
|
||||
testing any features, we cannot return an error code. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int extvar;
|
||||
|
||||
|
@ -125,10 +244,13 @@ implementation */
|
|||
|
||||
target = ~0U;
|
||||
mask = 1;
|
||||
printf("sizeof target: %08x pd0->cbits: %08x\n", sizeof target, pd0->cbits);
|
||||
printf("mask: %08x target: %08x\n", mask, target);
|
||||
|
||||
for(j=0; j<(sizeof target)*pd0->cbits; j++){
|
||||
mask = mask⌖
|
||||
target = target>>1;
|
||||
printf("mask: %08x target: %08x\n", mask, target);
|
||||
}
|
||||
|
||||
if(mask != 1 || target != 0){
|
||||
|
@ -200,11 +322,12 @@ setev(){
|
|||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s4(pd0);
|
||||
case 0: return s26(pd0);
|
||||
case 1: return s4(pd0);
|
||||
}
|
||||
}
|
||||
|
||||
#define cq_sections 1
|
||||
#define cq_sections 2
|
||||
|
||||
/*
|
||||
C REFERENCE MANUAL (main)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*include "cq26.c"*/ /* hardware check */
|
||||
|
||||
struct defs {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
|
Loading…
Add table
Reference in a new issue