Made compilable with ANSI C compiler
authorceriel <none@none>
Tue, 6 Nov 1990 13:02:55 +0000 (13:02 +0000)
committerceriel <none@none>
Tue, 6 Nov 1990 13:02:55 +0000 (13:02 +0000)
15 files changed:
lang/pc/libpc/arg.c
lang/pc/libpc/atn.c
lang/pc/libpc/clock.c
lang/pc/libpc/exp.c
lang/pc/libpc/log.c
lang/pc/libpc/new.c
lang/pc/libpc/nfa.c
lang/pc/libpc/pac.c
lang/pc/libpc/rdi.c
lang/pc/libpc/rdl.c
lang/pc/libpc/rdr.c
lang/pc/libpc/sin.c
lang/pc/libpc/sqt.c
lang/pc/libpc/unp.c
lang/pc/libpc/wri.c

index 91d0157..7702582 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 /* Author: J.W. Stevenson */
-/*
+
 /* function argc:integer; extern; */
 /* function argv(i:integer):string; extern; */
 /* procedure argshift; extern; */
index 92205a5..320c189 100644 (file)
 #define __NO_DEFS
 #include <math.h>
 
+#if __STDC__
+#include <pc_math.h>
+#endif
+
 double
 _atn(x)
        double x;
index 73997fb..d790ddd 100644 (file)
@@ -29,6 +29,10 @@ struct tbuf {
        long    cstime;
 };
 
+#ifndef EM_WSIZE
+#define EM_WSIZE _EM_WSIZE
+#endif
+
 int clock() {
        struct tbuf t;
 
index a080ef3..0c02278 100644 (file)
 #include <pc_err.h>
 extern _trp();
 
+#if __STDC__
+#include <float.h>
+#include <pc_math.h>
+#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));
 }
index 324fa21..efabbc6 100644 (file)
 #include <math.h>
 #include <pc_err.h>
 
+#if __STDC__
+#include <pc_math.h>
+#define HUGE   HUGE_VAL
+#endif
+
 double
 _log(x)
        double  x;
index 903706a..6ea6a30 100644 (file)
@@ -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;
 }
index d310bf9..cfdb9af 100644 (file)
@@ -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       <pc_err.h>
 
-extern trp();
+extern _trp();
 
 _nfa(bool)
 {
index 6c547bd..c40e6fe 100644 (file)
@@ -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)
index f6b4084..fa1909b 100644 (file)
@@ -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; {
index 6a3670c..76fa6a3 100644 (file)
@@ -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);
 }
index 475c4c7..a9ea1c8 100644 (file)
@@ -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);
 }
index 521b589..47132a4 100644 (file)
 #define __NO_DEFS
 #include <math.h>
 
+#if __STDC__
+#include <pc_math.h>
+#endif
+
 static double
 sinus(x, cos_flag)
        double x;
index 7a152d0..5f6f1b9 100644 (file)
@@ -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;
        }
index 98a3e91..d1c35ca 100644 (file)
@@ -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)
index 43e2468..11a8dc9 100644 (file)
 
 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