Made compilable with ANSI C compiler
This commit is contained in:
parent
87a8061e1c
commit
f192338596
15 changed files with 69 additions and 20 deletions
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Author: J.W. Stevenson */
|
/* Author: J.W. Stevenson */
|
||||||
/*
|
|
||||||
/* function argc:integer; extern; */
|
/* function argc:integer; extern; */
|
||||||
/* function argv(i:integer):string; extern; */
|
/* function argv(i:integer):string; extern; */
|
||||||
/* procedure argshift; extern; */
|
/* procedure argshift; extern; */
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
#define __NO_DEFS
|
#define __NO_DEFS
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <pc_math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
double
|
double
|
||||||
_atn(x)
|
_atn(x)
|
||||||
double x;
|
double x;
|
||||||
|
|
|
@ -29,6 +29,10 @@ struct tbuf {
|
||||||
long cstime;
|
long cstime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef EM_WSIZE
|
||||||
|
#define EM_WSIZE _EM_WSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
int clock() {
|
int clock() {
|
||||||
struct tbuf t;
|
struct tbuf t;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,16 @@
|
||||||
#include <pc_err.h>
|
#include <pc_err.h>
|
||||||
extern _trp();
|
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
|
static double
|
||||||
ldexp(fl,exp)
|
Ldexp(fl,exp)
|
||||||
double fl;
|
double fl;
|
||||||
int exp;
|
int exp;
|
||||||
{
|
{
|
||||||
|
@ -97,5 +105,5 @@ _exp(x)
|
||||||
xn = g * g;
|
xn = g * g;
|
||||||
x = g * POLYNOM2(xn, p);
|
x = g * POLYNOM2(xn, p);
|
||||||
n += 1;
|
n += 1;
|
||||||
return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
|
return (Ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <pc_err.h>
|
#include <pc_err.h>
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <pc_math.h>
|
||||||
|
#define HUGE HUGE_VAL
|
||||||
|
#endif
|
||||||
|
|
||||||
double
|
double
|
||||||
_log(x)
|
_log(x)
|
||||||
double x;
|
double x;
|
||||||
|
|
|
@ -34,6 +34,7 @@ struct adm *_highp = 0;
|
||||||
|
|
||||||
_new(n,pp) int n; struct adm **pp; {
|
_new(n,pp) int n; struct adm **pp; {
|
||||||
struct adm *p,*q;
|
struct adm *p,*q;
|
||||||
|
int *ptmp;
|
||||||
|
|
||||||
n = ((n+sizeof(*p)-1) / sizeof(*p)) * sizeof(*p);
|
n = ((n+sizeof(*p)-1) / sizeof(*p)) * sizeof(*p);
|
||||||
if ((p = _lastp) != 0)
|
if ((p = _lastp) != 0)
|
||||||
|
@ -62,6 +63,7 @@ _new(n,pp) int n; struct adm **pp; {
|
||||||
_rst(&q);
|
_rst(&q);
|
||||||
initialize:
|
initialize:
|
||||||
*pp = p;
|
*pp = p;
|
||||||
while (p < q)
|
ptmp = (int *)p;
|
||||||
*((int *)p)++ = UNDEF;
|
while (ptmp < (int *)q)
|
||||||
|
*ptmp++ = UNDEF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 */
|
/* Author: Hans van Eck */
|
||||||
|
|
||||||
#include <pc_err.h>
|
#include <pc_err.h>
|
||||||
|
|
||||||
extern trp();
|
extern _trp();
|
||||||
|
|
||||||
_nfa(bool)
|
_nfa(bool)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,10 @@ extern _trp();
|
||||||
|
|
||||||
#define assert(x) /* nothing */
|
#define assert(x) /* nothing */
|
||||||
|
|
||||||
|
#ifndef EM_WSIZE
|
||||||
|
#define EM_WSIZE _EM_WSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
struct descr {
|
struct descr {
|
||||||
int low;
|
int low;
|
||||||
int diff;
|
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);
|
ap += (i * ad->size);
|
||||||
i = (zd->diff + 1) * zd->size;
|
i = (zd->diff + 1) * zd->size;
|
||||||
if (zd->size == 1) {
|
if (zd->size == 1) {
|
||||||
|
int *aptmp = (int *)ap;
|
||||||
assert(ad->size == EM_WSIZE);
|
assert(ad->size == EM_WSIZE);
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
*zp++ = *((int *)ap)++;
|
*zp++ = *aptmp++;
|
||||||
} else {
|
} else {
|
||||||
assert(ad->size == zd->size);
|
assert(ad->size == zd->size);
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
|
|
|
@ -60,15 +60,15 @@ int _nxtdig(f) struct file *f; {
|
||||||
}
|
}
|
||||||
|
|
||||||
int _getint(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);
|
ch = _fstdig(f);
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
do
|
||||||
i = i*10 - ch;
|
i = i*10 - ch;
|
||||||
while ((ch = _nxtdig(f)) >= 0);
|
while ((ch = _nxtdig(f)) >= 0);
|
||||||
return(signed ? i : -i);
|
return(is_signed ? i : -i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _rdi(f) struct file *f; {
|
int _rdi(f) struct file *f; {
|
||||||
|
|
|
@ -27,15 +27,15 @@ extern int _fstdig();
|
||||||
extern int _nxtdig();
|
extern int _nxtdig();
|
||||||
|
|
||||||
long _rdl(f) struct file *f; {
|
long _rdl(f) struct file *f; {
|
||||||
int signed,ch; long l;
|
int is_signed,ch; long l;
|
||||||
|
|
||||||
_rf(f);
|
_rf(f);
|
||||||
_skipsp(f);
|
_skipsp(f);
|
||||||
signed = _getsig(f);
|
is_signed = _getsig(f);
|
||||||
ch = _fstdig(f);
|
ch = _fstdig(f);
|
||||||
l = 0;
|
l = 0;
|
||||||
do
|
do
|
||||||
l = l*10 - ch;
|
l = l*10 - ch;
|
||||||
while ((ch = _nxtdig(f)) >= 0);
|
while ((ch = _nxtdig(f)) >= 0);
|
||||||
return(signed ? l : -l);
|
return(is_signed ? l : -l);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,13 @@ static dig(ch) int ch; {
|
||||||
}
|
}
|
||||||
|
|
||||||
double _rdr(f) struct file *f; {
|
double _rdr(f) struct file *f; {
|
||||||
int i; double e; int signed,ch;
|
int i; double e; int is_signed,ch;
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
pow10 = 0;
|
pow10 = 0;
|
||||||
_rf(f);
|
_rf(f);
|
||||||
_skipsp(f);
|
_skipsp(f);
|
||||||
signed = _getsig(f);
|
is_signed = _getsig(f);
|
||||||
ch = _fstdig(f);
|
ch = _fstdig(f);
|
||||||
do
|
do
|
||||||
dig(ch);
|
dig(ch);
|
||||||
|
@ -74,5 +74,5 @@ double _rdr(f) struct file *f; {
|
||||||
r /= e;
|
r /= e;
|
||||||
else
|
else
|
||||||
r *= e;
|
r *= e;
|
||||||
return(signed? -r : r);
|
return(is_signed? -r : r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
#define __NO_DEFS
|
#define __NO_DEFS
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <pc_math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static double
|
static double
|
||||||
sinus(x, cos_flag)
|
sinus(x, cos_flag)
|
||||||
double x;
|
double x;
|
||||||
|
|
|
@ -14,7 +14,7 @@ extern _trp();
|
||||||
#define NITER 5
|
#define NITER 5
|
||||||
|
|
||||||
static double
|
static double
|
||||||
ldexp(fl,exp)
|
Ldexp(fl,exp)
|
||||||
double fl;
|
double fl;
|
||||||
int exp;
|
int exp;
|
||||||
{
|
{
|
||||||
|
@ -63,8 +63,8 @@ _sqt(x)
|
||||||
exponent--;
|
exponent--;
|
||||||
val *= 2;
|
val *= 2;
|
||||||
}
|
}
|
||||||
val = ldexp(val + 1.0, exponent/2 - 1);
|
val = Ldexp(val + 1.0, exponent/2 - 1);
|
||||||
/* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */
|
/* was: val = (val + 1.0)/2.0; val = Ldexp(val, exponent/2); */
|
||||||
for (exponent = NITER - 1; exponent >= 0; exponent--) {
|
for (exponent = NITER - 1; exponent >= 0; exponent--) {
|
||||||
val = (val + x / val) / 2.0;
|
val = (val + x / val) / 2.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ extern _trp();
|
||||||
|
|
||||||
#define assert(x) /* nothing */
|
#define assert(x) /* nothing */
|
||||||
|
|
||||||
|
#ifndef EM_WSIZE
|
||||||
|
#define EM_WSIZE _EM_WSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
struct descr {
|
struct descr {
|
||||||
int low;
|
int low;
|
||||||
int diff;
|
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);
|
ap += (i * ad->size);
|
||||||
i = (zd->diff + 1) * zd->size;
|
i = (zd->diff + 1) * zd->size;
|
||||||
if (zd->size == 1) {
|
if (zd->size == 1) {
|
||||||
|
int *aptmp = (int *) ap;
|
||||||
assert(ad->size == EM_WSIZE);
|
assert(ad->size == EM_WSIZE);
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
*((int *)ap)++ = *zp++;
|
*aptmp++ = *zp++;
|
||||||
} else {
|
} else {
|
||||||
assert(ad->size == zd->size);
|
assert(ad->size == zd->size);
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
|
|
|
@ -21,6 +21,12 @@
|
||||||
|
|
||||||
extern _wstrin();
|
extern _wstrin();
|
||||||
|
|
||||||
|
#ifndef EM_WSIZE
|
||||||
|
#ifdef _EM_WSIZE
|
||||||
|
#define EM_WSIZE _EM_WSIZE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if EM_WSIZE==4
|
#if EM_WSIZE==4
|
||||||
#define SZ 11
|
#define SZ 11
|
||||||
#define MININT -2147483648
|
#define MININT -2147483648
|
||||||
|
|
Loading…
Reference in a new issue