Made compilable with ANSI C compiler

This commit is contained in:
ceriel 1990-11-06 13:02:55 +00:00
parent 87a8061e1c
commit f192338596
15 changed files with 69 additions and 20 deletions

View file

@ -17,7 +17,7 @@
*/
/* Author: J.W. Stevenson */
/*
/* function argc:integer; extern; */
/* function argv(i:integer):string; extern; */
/* procedure argshift; extern; */

View file

@ -10,6 +10,10 @@
#define __NO_DEFS
#include <math.h>
#if __STDC__
#include <pc_math.h>
#endif
double
_atn(x)
double x;

View file

@ -29,6 +29,10 @@ struct tbuf {
long cstime;
};
#ifndef EM_WSIZE
#define EM_WSIZE _EM_WSIZE
#endif
int clock() {
struct tbuf t;

View file

@ -11,8 +11,16 @@
#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));
}

View file

@ -11,6 +11,11 @@
#include <math.h>
#include <pc_err.h>
#if __STDC__
#include <pc_math.h>
#define HUGE HUGE_VAL
#endif
double
_log(x)
double x;

View 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;
}

View 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)
{

View 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)

View 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; {

View 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);
}

View 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);
}

View file

@ -10,6 +10,10 @@
#define __NO_DEFS
#include <math.h>
#if __STDC__
#include <pc_math.h>
#endif
static double
sinus(x, cos_flag)
double x;

View 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;
}

View 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)

View file

@ -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