From: ceriel Date: Tue, 6 Nov 1990 13:02:55 +0000 (+0000) Subject: Made compilable with ANSI C compiler X-Git-Tag: release-5-5~1443 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f192338596df8d23a504ea60b1dea0e09511a7c9;p=ack.git Made compilable with ANSI C compiler --- diff --git a/lang/pc/libpc/arg.c b/lang/pc/libpc/arg.c index 91d015797..77025822b 100644 --- a/lang/pc/libpc/arg.c +++ b/lang/pc/libpc/arg.c @@ -17,7 +17,7 @@ */ /* Author: J.W. Stevenson */ -/* + /* function argc:integer; extern; */ /* function argv(i:integer):string; extern; */ /* procedure argshift; extern; */ diff --git a/lang/pc/libpc/atn.c b/lang/pc/libpc/atn.c index 92205a54d..320c18923 100644 --- a/lang/pc/libpc/atn.c +++ b/lang/pc/libpc/atn.c @@ -10,6 +10,10 @@ #define __NO_DEFS #include +#if __STDC__ +#include +#endif + double _atn(x) double x; diff --git a/lang/pc/libpc/clock.c b/lang/pc/libpc/clock.c index 73997fb82..d790ddd10 100644 --- a/lang/pc/libpc/clock.c +++ b/lang/pc/libpc/clock.c @@ -29,6 +29,10 @@ struct tbuf { long cstime; }; +#ifndef EM_WSIZE +#define EM_WSIZE _EM_WSIZE +#endif + int clock() { struct tbuf t; diff --git a/lang/pc/libpc/exp.c b/lang/pc/libpc/exp.c index a080ef39a..0c02278c8 100644 --- a/lang/pc/libpc/exp.c +++ b/lang/pc/libpc/exp.c @@ -11,8 +11,16 @@ #include extern _trp(); +#if __STDC__ +#include +#include +#define M_MIN_D DBL_MIN +#define M_MAX_D DBL_MAX +#define HUGE HUGE_VAL +#endif + static double -ldexp(fl,exp) +Ldexp(fl,exp) double fl; int exp; { @@ -97,5 +105,5 @@ _exp(x) xn = g * g; x = g * POLYNOM2(xn, p); n += 1; - return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n)); + return (Ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n)); } diff --git a/lang/pc/libpc/log.c b/lang/pc/libpc/log.c index 324fa2103..efabbc682 100644 --- a/lang/pc/libpc/log.c +++ b/lang/pc/libpc/log.c @@ -11,6 +11,11 @@ #include #include +#if __STDC__ +#include +#define HUGE HUGE_VAL +#endif + double _log(x) double x; diff --git a/lang/pc/libpc/new.c b/lang/pc/libpc/new.c index 903706a3f..6ea6a304a 100644 --- a/lang/pc/libpc/new.c +++ b/lang/pc/libpc/new.c @@ -34,6 +34,7 @@ struct adm *_highp = 0; _new(n,pp) int n; struct adm **pp; { struct adm *p,*q; + int *ptmp; n = ((n+sizeof(*p)-1) / sizeof(*p)) * sizeof(*p); if ((p = _lastp) != 0) @@ -62,6 +63,7 @@ _new(n,pp) int n; struct adm **pp; { _rst(&q); initialize: *pp = p; - while (p < q) - *((int *)p)++ = UNDEF; + ptmp = (int *)p; + while (ptmp < (int *)q) + *ptmp++ = UNDEF; } diff --git a/lang/pc/libpc/nfa.c b/lang/pc/libpc/nfa.c index d310bf903..cfdb9af4d 100644 --- a/lang/pc/libpc/nfa.c +++ b/lang/pc/libpc/nfa.c @@ -1,8 +1,14 @@ +/* $Header$ */ +/* + * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ + /* Author: Hans van Eck */ #include -extern trp(); +extern _trp(); _nfa(bool) { diff --git a/lang/pc/libpc/pac.c b/lang/pc/libpc/pac.c index 6c547bd31..c40e6febe 100644 --- a/lang/pc/libpc/pac.c +++ b/lang/pc/libpc/pac.c @@ -24,6 +24,10 @@ extern _trp(); #define assert(x) /* nothing */ +#ifndef EM_WSIZE +#define EM_WSIZE _EM_WSIZE +#endif + struct descr { int low; int diff; @@ -39,9 +43,10 @@ _pac(ad,zd,zp,i,ap) int i; struct descr *ad,*zd; char *zp,*ap; { ap += (i * ad->size); i = (zd->diff + 1) * zd->size; if (zd->size == 1) { + int *aptmp = (int *)ap; assert(ad->size == EM_WSIZE); while (--i >= 0) - *zp++ = *((int *)ap)++; + *zp++ = *aptmp++; } else { assert(ad->size == zd->size); while (--i >= 0) diff --git a/lang/pc/libpc/rdi.c b/lang/pc/libpc/rdi.c index f6b408461..fa1909b81 100644 --- a/lang/pc/libpc/rdi.c +++ b/lang/pc/libpc/rdi.c @@ -60,15 +60,15 @@ int _nxtdig(f) struct file *f; { } int _getint(f) struct file *f; { - int signed,i,ch; + int is_signed,i,ch; - signed = _getsig(f); + is_signed = _getsig(f); ch = _fstdig(f); i = 0; do i = i*10 - ch; while ((ch = _nxtdig(f)) >= 0); - return(signed ? i : -i); + return(is_signed ? i : -i); } int _rdi(f) struct file *f; { diff --git a/lang/pc/libpc/rdl.c b/lang/pc/libpc/rdl.c index 6a3670ceb..76fa6a3f8 100644 --- a/lang/pc/libpc/rdl.c +++ b/lang/pc/libpc/rdl.c @@ -27,15 +27,15 @@ extern int _fstdig(); extern int _nxtdig(); long _rdl(f) struct file *f; { - int signed,ch; long l; + int is_signed,ch; long l; _rf(f); _skipsp(f); - signed = _getsig(f); + is_signed = _getsig(f); ch = _fstdig(f); l = 0; do l = l*10 - ch; while ((ch = _nxtdig(f)) >= 0); - return(signed ? l : -l); + return(is_signed ? l : -l); } diff --git a/lang/pc/libpc/rdr.c b/lang/pc/libpc/rdr.c index 475c4c792..a9ea1c8f3 100644 --- a/lang/pc/libpc/rdr.c +++ b/lang/pc/libpc/rdr.c @@ -42,13 +42,13 @@ static dig(ch) int ch; { } double _rdr(f) struct file *f; { - int i; double e; int signed,ch; + int i; double e; int is_signed,ch; r = 0; pow10 = 0; _rf(f); _skipsp(f); - signed = _getsig(f); + is_signed = _getsig(f); ch = _fstdig(f); do dig(ch); @@ -74,5 +74,5 @@ double _rdr(f) struct file *f; { r /= e; else r *= e; - return(signed? -r : r); + return(is_signed? -r : r); } diff --git a/lang/pc/libpc/sin.c b/lang/pc/libpc/sin.c index 521b5893d..47132a45d 100644 --- a/lang/pc/libpc/sin.c +++ b/lang/pc/libpc/sin.c @@ -10,6 +10,10 @@ #define __NO_DEFS #include +#if __STDC__ +#include +#endif + static double sinus(x, cos_flag) double x; diff --git a/lang/pc/libpc/sqt.c b/lang/pc/libpc/sqt.c index 7a152d00c..5f6f1b9d7 100644 --- a/lang/pc/libpc/sqt.c +++ b/lang/pc/libpc/sqt.c @@ -14,7 +14,7 @@ extern _trp(); #define NITER 5 static double -ldexp(fl,exp) +Ldexp(fl,exp) double fl; int exp; { @@ -63,8 +63,8 @@ _sqt(x) exponent--; val *= 2; } - val = ldexp(val + 1.0, exponent/2 - 1); - /* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */ + val = Ldexp(val + 1.0, exponent/2 - 1); + /* was: val = (val + 1.0)/2.0; val = Ldexp(val, exponent/2); */ for (exponent = NITER - 1; exponent >= 0; exponent--) { val = (val + x / val) / 2.0; } diff --git a/lang/pc/libpc/unp.c b/lang/pc/libpc/unp.c index 98a3e9149..d1c35ca86 100644 --- a/lang/pc/libpc/unp.c +++ b/lang/pc/libpc/unp.c @@ -24,6 +24,10 @@ extern _trp(); #define assert(x) /* nothing */ +#ifndef EM_WSIZE +#define EM_WSIZE _EM_WSIZE +#endif + struct descr { int low; int diff; @@ -39,9 +43,10 @@ _unp(ad,zd,i,ap,zp) int i; struct descr *ad,*zd; char *ap,*zp; { ap += (i * ad->size); i = (zd->diff + 1) * zd->size; if (zd->size == 1) { + int *aptmp = (int *) ap; assert(ad->size == EM_WSIZE); while (--i >= 0) - *((int *)ap)++ = *zp++; + *aptmp++ = *zp++; } else { assert(ad->size == zd->size); while (--i >= 0) diff --git a/lang/pc/libpc/wri.c b/lang/pc/libpc/wri.c index 43e2468a9..11a8dc92d 100644 --- a/lang/pc/libpc/wri.c +++ b/lang/pc/libpc/wri.c @@ -21,6 +21,12 @@ extern _wstrin(); +#ifndef EM_WSIZE +#ifdef _EM_WSIZE +#define EM_WSIZE _EM_WSIZE +#endif +#endif + #if EM_WSIZE==4 #define SZ 11 #define MININT -2147483648