diff options
author | jmc <jmc> | 2002-03-15 00:22:42 +0000 |
---|---|---|
committer | jmc <jmc> | 2002-03-15 00:22:42 +0000 |
commit | f6ac44ec3868089c0ab210b85c830d5b7e8ccdd2 (patch) | |
tree | 178231c9ca6a83be0bb47d9dcc17f9ef54978f45 /lang | |
parent | 97ef289ebe235e33194e59ce57c567941ce51d0e (diff) | |
download | pkgsrc-f6ac44ec3868089c0ab210b85c830d5b7e8ccdd2.tar.gz |
Port for powerpc (or any other arch which enforces alignment).
This code was assuming it could copy double's in/out of char *'s with just
casts and normal copies. This blows up on anything which enforces alignments.
Change the generic case for the ATOM to just have a special double field.
For the serialization routines memcpy the double in and provide a union to
memcpy it out to that also contains a single double value. This ensures
alignment is correct and it won't SIGBUS anymore.
Bump pkg to nb1
Diffstat (limited to 'lang')
-rw-r--r-- | lang/vslisp/Makefile | 3 | ||||
-rw-r--r-- | lang/vslisp/distinfo | 5 | ||||
-rw-r--r-- | lang/vslisp/patches/patch-ac | 21 | ||||
-rw-r--r-- | lang/vslisp/patches/patch-ad | 63 | ||||
-rw-r--r-- | lang/vslisp/patches/patch-ae | 41 |
5 files changed, 131 insertions, 2 deletions
diff --git a/lang/vslisp/Makefile b/lang/vslisp/Makefile index 2086b0aea74..03fa7dbadd0 100644 --- a/lang/vslisp/Makefile +++ b/lang/vslisp/Makefile @@ -1,9 +1,10 @@ -# $NetBSD: Makefile,v 1.6 2001/04/22 12:07:13 zuntum Exp $ +# $NetBSD: Makefile,v 1.7 2002/03/15 00:22:42 jmc Exp $ DISTNAME= vslisp-4.0-1 PKGNAME= vslisp-4.0.1 CATEGORIES= lang MASTER_SITES= ftp://vslisp.sourceforge.net/pub/vslisp/ +PKGREVISION= 1 MAINTAINER= packages@netbsd.org HOMEPAGE= http://vslisp.sourceforge.net/ diff --git a/lang/vslisp/distinfo b/lang/vslisp/distinfo index 09ae14ea25c..b59649b1cea 100644 --- a/lang/vslisp/distinfo +++ b/lang/vslisp/distinfo @@ -1,6 +1,9 @@ -$NetBSD: distinfo,v 1.2 2001/04/19 15:01:01 agc Exp $ +$NetBSD: distinfo,v 1.3 2002/03/15 00:22:42 jmc Exp $ SHA1 (vslisp-4.0-1.tar.gz) = ccd21360f6bd2a7f47638797a7a5d25d2f8cb797 Size (vslisp-4.0-1.tar.gz) = 167403 bytes SHA1 (patch-aa) = 5a397669bed7663ccdbd86d57e7669a70d16b5e1 SHA1 (patch-ab) = 645d4a4ffd6949b9406083744b71676220bf19be +SHA1 (patch-ac) = 490975b1e19ee6aaaf05fb2ade1d79e805257540 +SHA1 (patch-ad) = a08e31d1c11aa8aae909c2641f4f80f4ca39413a +SHA1 (patch-ae) = b39473d8008d48ba19fc980e374bc95c28996705 diff --git a/lang/vslisp/patches/patch-ac b/lang/vslisp/patches/patch-ac new file mode 100644 index 00000000000..d3451169f9b --- /dev/null +++ b/lang/vslisp/patches/patch-ac @@ -0,0 +1,21 @@ +$NetBSD: patch-ac,v 1.1 2002/03/15 00:22:42 jmc Exp $ + +--- src/l_defs.h.orig Fri Mar 15 00:16:28 2002 ++++ src/l_defs.h Fri Mar 15 00:16:40 2002 +@@ -69,6 +69,7 @@ + uc * a; + /** Additional information */ + uc * b; ++ double d; + }; + /** ATOM pointer */ + typedef struct _ato * ATOM; +@@ -141,7 +142,7 @@ + ATOM MakeDAtom(double d); + ATOM MakeFAtom(FILE *d); + /* double GetDouble(ATOM a); */ +-#define GetDouble(at) (*((double *)((at)->a))) ++#define GetDouble(at) ((at)->d) + int kilatom(ATOM a); + int killlist(LIST l); + int kilat(ATOM a); diff --git a/lang/vslisp/patches/patch-ad b/lang/vslisp/patches/patch-ad new file mode 100644 index 00000000000..430619be6d5 --- /dev/null +++ b/lang/vslisp/patches/patch-ad @@ -0,0 +1,63 @@ +$NetBSD: patch-ad,v 1.1 2002/03/15 00:22:43 jmc Exp $ + +--- src/lc.c.orig Fri Mar 15 00:16:37 2002 ++++ src/lc.c Fri Mar 15 00:16:49 2002 +@@ -124,9 +124,11 @@ + return y; + } + if(((l->f)>>1)==4) { /* DOUBLE */ ++ double d; + pos= *l2;y=pos; + b[pos]=l->f;pos++; +- *(double *)(b+pos)=GetDouble((ATOM)l); ++ d=GetDouble((ATOM)l); ++ memcpy(b+pos, &d, sizeof(double)); + pos+=sizeof(double); + *l2=pos; + ltab[ltabn].p=(uc *)l;ltab[ltabn].v=y;ltabn++; +@@ -155,10 +157,12 @@ + if((l->f)&1) { /* LIST */ + } else { + if(((l->f)>>1)==4) { ++ double d; + b[*l1]=3;(*l1)++; + a=strlen(global.Symbols[n]->nm);b[*l1]=a; (*l1)++; + memcpy(b+(*l1),global.Symbols[n]->nm,a);(*l1)+=a; +- *(double *)(b+(*l1))=GetDouble((ATOM)l);(*l1)+=sizeof(double); ++ d=GetDouble((ATOM)l); ++ memcpy(b+(*l1), &d, sizeof(double));(*l1)+=sizeof(double); + return 0; + } else + if(((l->f)>>1)==0) { +@@ -267,7 +271,12 @@ + } + /* It's ATOM */ + if(((*b)>>1)==4) { /*DOUBLE*/ +- return (LIST)MakeDAtom(*((double *)(b+1))); ++ union dd { ++ char a[sizeof(double)]; ++ double d; ++ } dd; ++ memcpy(&dd.a, b+1, sizeof(double)); ++ return (LIST)MakeDAtom(dd.d); + } else + { /*STRING*/ + return (LIST)MakeAtom(b+1); +@@ -311,11 +320,16 @@ + l1+=1+l1[1]+4+ *((ui *)(l1+1+l1[1]+1))+1; + } else + if(*l1==3) { ++ union dd { ++ char a[sizeof(double)]; ++ double d; ++ } dd; ++ memcpy(&dd.a, (l1+1+l1[1]+1), sizeof(double)); + memcpy(ss,l1+2,*(l1+1)); + ss[(int)l1[1]]=0; + t1=mklist(NIL,mklist((LIST)MakeAtom(ss), + mklist(mklist((LIST)MakeAtom("quote"), +- mklist((LIST)MakeDAtom(*((double *)(l1+1+l1[1]+1))), ++ mklist((LIST)MakeDAtom(dd.d), + NIL)),NIL))); + t1->g=0; + L_Setq(&global,t1); diff --git a/lang/vslisp/patches/patch-ae b/lang/vslisp/patches/patch-ae new file mode 100644 index 00000000000..29628174517 --- /dev/null +++ b/lang/vslisp/patches/patch-ae @@ -0,0 +1,41 @@ +$NetBSD: patch-ae,v 1.1 2002/03/15 00:22:43 jmc Exp $ + +--- src/lcore.c.orig Fri Mar 15 00:16:32 2002 ++++ src/lcore.c Fri Mar 15 00:16:44 2002 +@@ -113,7 +113,7 @@ + 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 +180,7 @@ + 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 +198,7 @@ + /*--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" */ +@@ -249,7 +248,7 @@ + { + double *d; + t=mkatm(sizeof(double));t->f=4<<1; +- d=(double*)(t->a); ++ d=&t->d; + sscanf(c,"%lf",d); + } + return t; |