pkgsrc/lang/vslisp/patches/patch-ae
joerg 1fa99f4874 Mark as MAKE_JOBS_SAFE=no for race conditions. While here, fix ctype
abuse and a bunch of other warnings. Defensively bump revision.
2016-01-17 15:14:47 +00:00

68 lines
1.9 KiB
Text

$NetBSD: patch-ae,v 1.3 2016/01/17 15:14:47 joerg Exp $
Handle floating values properly.
--- src/lcore.c.orig 2000-05-07 20:26:14.000000000 +0000
+++ src/lcore.c
@@ -9,6 +9,8 @@
*
* */
+int InitMiscFuns(void);
+
char IL_Version[] = "4.0";
#ifndef lint
@@ -113,7 +115,7 @@ char *lText(ATOM a,char *TeXt)
case 1: sprintf(TeXt,"[^H]");return TeXt;
case 2: sprintf(TeXt,"[^F]");return TeXt;
case 3: sprintf(TeXt,"[^T]");return TeXt;
- case 4: sprintf(TeXt,"%g",*(double*)(a->a)); return TeXt;
+ case 4: sprintf(TeXt,"%g",a->d); return TeXt;
case 6: sprintf(TeXt,"%d",*(int*)(a->a)); return TeXt;
case 5: sprintf(TeXt,"[^II]");return TeXt;
case 8: sprintf(TeXt,"[^IF]");return TeXt;
@@ -180,6 +182,7 @@ ATOM MakeDAtom(double d)
tmp->a=(char *)malloc(sizeof(double));
dd=(double *)(tmp->a);
(*dd)=d;
+ tmp->d = d;
tmp->g=1;tmp->f=4<<1;tmp->b=NULL;
return tmp;
}
@@ -197,9 +200,7 @@ ATOM MakeFAtom(FILE *d)
/*--X FNAME: "GetDouble" DESC: "Takes a double from atom a" */
double GetDbleOld(ATOM a)
{
- double *dd;
- dd=(double*)(a->a);
- return *dd;
+ return a->d;
}
/*--X VNAME: "Pos" DESC: "Temporary variable for a string to list conversion" */
@@ -233,12 +234,12 @@ ATOM reada(char *s)
}
else {
c[i]=s[Pos]; c[i+1]=0;
- if(!(isdigit(c[i]) || (c[i]=='+') || (c[i]=='-') || (c[i]=='.'))) {
+ if(!(isdigit((unsigned char)c[i]) || (c[i]=='+') || (c[i]=='-') || (c[i]=='.'))) {
if(i) {
- if(!((c[i]=='e' || c[i]=='E') && (c[i-1]=='.' || isdigit(c[i-1])))) fd=0;
+ if(!((c[i]=='e' || c[i]=='E') && (c[i-1]=='.' || isdigit((unsigned char)c[i-1])))) fd=0;
} else fd=0;
}
- if(isdigit(c[i])) nd++;
+ if(isdigit((unsigned char)c[i])) nd++;
}
}
c[i]=0;
@@ -249,7 +250,7 @@ ATOM reada(char *s)
{
double *d;
t=mkatm(sizeof(double));t->f=4<<1;
- d=(double*)(t->a);
+ d=&t->d;
sscanf(c,"%lf",d);
}
return t;