Added NOFL to Makefile, to pass NOFLOAT. Also improved the clean entry

This commit is contained in:
ceriel 1987-07-13 16:50:57 +00:00
parent ea247567ba
commit 59e3fd6c2c
3 changed files with 35 additions and 18 deletions

View file

@ -1,33 +1,35 @@
# $Header$ # $Header$
NOFL =
all: testC testI all: testC testI
testI: testI:
# int t1.p; em # int $(NOFL) t1.p; em
int t2.p; em int $(NOFL) t2.p; em
int t3.p; em e.out f1 f2 f3 f4 f5 f6 int $(NOFL) t3.p; em e.out f1 f2 f3 f4 f5 f6
int t4.p; em int $(NOFL) t4.p; em
int t5.p; em int $(NOFL) t5.p; em
int tstenc.p; em int $(NOFL) tstenc.p; em
int tstgto.p; em int $(NOFL) tstgto.p; em
int -.p callc.p cmod.c ; em int $(NOFL) -.p callc.p cmod.c ; em
rm -f e.out f? *.k rm -f e.out f? *.k
testC: testC:
apc t1.p; a.out apc $(NOFL) t1.p; a.out
apc t2.p; a.out apc $(NOFL) t2.p; a.out
apc t3.p; a.out f1 f2 f3 f4 f5 f6 apc $(NOFL) t3.p; a.out f1 f2 f3 f4 f5 f6
apc t4.p; a.out apc $(NOFL) t4.p; a.out
apc t5.p; a.out apc $(NOFL) t5.p; a.out
apc tstenc.p; a.out apc $(NOFL) tstenc.p; a.out
apc tstgto.p; a.out apc $(NOFL) tstgto.p; a.out
apc -.p callc.p cmod.c ; a.out apc $(NOFL) -.p callc.p cmod.c ; a.out
rm -f a.out f? *.[os] rm -f a.out f? *.[os]
install cmp: install cmp:
clean: clean:
-rm -f [ea].out f? -rm -f [ea].out f? *.o
opr: opr:
make pr | opr make pr | opr

View file

@ -1,3 +1,4 @@
#
program callc(input,output) ; program callc(input,output) ;
var success: integer ; var success: integer ;
procedure rcsid ; begin writeln('$Header$') end ; procedure rcsid ; begin writeln('$Header$') end ;
@ -5,6 +6,7 @@ function kwad(val:integer) : integer ; extern ;
procedure cmain ; extern ; procedure cmain ; extern ;
procedure incs ; begin success:=success+1 end ; procedure incs ; begin success:=success+1 end ;
procedure pptr( function ptwice(val:integer):integer ) ; extern ; procedure pptr( function ptwice(val:integer):integer ) ; extern ;
#ifndef NOFLOAT
function ceval( function pinside(val:integer):real ): boolean ; extern ; function ceval( function pinside(val:integer):real ): boolean ; extern ;
function outside(val:integer):real ; function outside(val:integer):real ;
begin begin
@ -25,6 +27,7 @@ begin
if ceval(outside) then success:=success+1 if ceval(outside) then success:=success+1
else writeln('Calling outside through C doesn''t work') else writeln('Calling outside through C doesn''t work')
end; end;
#endif
procedure cptr( function pkwad(val:integer):integer ) ; procedure cptr( function pkwad(val:integer):integer ) ;
begin begin
if ( pkwad(-2)<>4 ) and (pkwad(-8)<>64) then if ( pkwad(-2)<>4 ) and (pkwad(-8)<>64) then
@ -44,7 +47,15 @@ begin
success:=success+1 ; success:=success+1 ;
cmain; cmain;
pptr(twice) ; pptr(twice) ;
#ifndef NOFLOAT
envellop ; envellop ;
if success <>7 then writeln('Only ',success,' tests passed') #endif
if success <>
#ifdef NOFLOAT
4
#else
7
#endif
then writeln('Only ',success,' tests passed')
else writeln('All tests passed') else writeln('All tests passed')
end. end.

View file

@ -10,10 +10,12 @@ typedef struct {
char *p_slink ; char *p_slink ;
} p_fiptr ; } p_fiptr ;
#ifndef NOFLOAT
typedef struct { typedef struct {
double (*p_func)() ; double (*p_func)() ;
char *p_slink ; char *p_slink ;
} p_ffptr ; } p_ffptr ;
#endif
int kwad(val) int val ; { return val*val ; } int kwad(val) int val ; { return val*val ; }
cmain() { cmain() {
@ -43,6 +45,7 @@ pptr(p_twice) p_fiptr p_twice ; {
else incs() ; else incs() ;
} }
#ifndef NOFLOAT
double callpas(pasfunc,par) p_ffptr pasfunc ; int par ; { double callpas(pasfunc,par) p_ffptr pasfunc ; int par ; {
/* Call a Pascal function, both inner block and outer block */ /* Call a Pascal function, both inner block and outer block */
/* Function must return a double, (In pascal terms: real) */ /* Function must return a double, (In pascal terms: real) */
@ -60,3 +63,4 @@ int ceval(p_inside) p_ffptr p_inside ; {
resval= callpas(p_inside,2) ; resval= callpas(p_inside,2) ;
return resval>1.41 && resval<1.42 ; return resval>1.41 && resval<1.42 ;
} }
#endif