Permalink
Browse files

fix void* to integer conversion problems on 32-bit #141

  • Loading branch information...
1 parent c906a4c commit 4ae1649a82a37655e580dc692669077fd3494a4b @kevinlawler kevinlawler committed Jul 29, 2011
Showing with 8 additions and 9 deletions.
  1. +2 −2 k.c
  2. +1 −2 kx.c
  3. +5 −5 p.c
View
4 k.c
@@ -102,14 +102,14 @@ I charsAdverb(C c) {R charpos(ac,c);}
I sva(V p) //simpleVerbArity: Use boundaries of arrays to determine verb class in O(1) constant time
{
- I q=p;
+ UI q=p;
if(q<DT_SIZE)R DT[q].arity;
R 0;
}
I adverbClass(V p) //0: not an adverb, 1: / \ ', 2: /: \: ':
{
- I q=p;
+ UI q=p;
if (q<DT_SIZE) R DT[q].adverbClass;
R 0;
}
View
3 kx.c
@@ -470,7 +470,7 @@ Z V ex_(V a, I r)//Expand wd()->7-0 types, expand and evaluate brackets
R z;
}
-K ex(K a){ U(a); K z=ex_(&a,0); cd(a);R z;} //Input is 7-0 type from wd()
+K ex(K a){U(a);K z=ex_(&a,0); cd(a);R z;} //Input is 7-0 type from wd()
Z K ex0(V*v,K k,I r) //r: {0,1,2} -> {code, (code), [code]} Reverse execution/return multiple (paren not function or script) "list notation" {4,5,6,7} -> {:,if,while,do}
{
@@ -598,7 +598,6 @@ K ex1(V*w,K k)//convert verb pieces (eg 1+/) to seven-types, default to ex2 (ful
{
//if(in(*w,adverbs)) R NYI;//Adverb at beginning of snippet eg '1 2 3 or ;':1 2 3; or 4;\1+1;4
I d;
-
if( DT_ADVERB_OFFSET <= *w && *w < DT_VERB_OFFSET )R NYI;
I c=0; while(w[c] && !bk(w[c])){c++; if(offsetColon==w[c-1])break;} //must break or assignment is n^2 (a:b:c:1)
View
10 p.c
@@ -527,7 +527,7 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K*dict,K func) //IN string, string le
i=DT_SPECIAL_VERB_OFFSET;
while(i < DT_SIZE && (!DT[i].text || SC(u, DT[i].text)))i++;
- if(i < DT_SIZE){z=i;} //faster is sp()/hash-table (compared to SC())
+ if(i < DT_SIZE){z=(V)i;} //faster is sp()/hash-table (compared to SC())
free(u);
P(!z,(I)kerr("reserved"))// _invalidsystemverbname
break; // _verb does not grab monadic ':' following
@@ -564,12 +564,12 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K*dict,K func) //IN string, string le
else if(modifier_colon){m[k+r]*=-1; r++; a=1; grab=1;} //grab monad ':' sign
i=0;
- if(r-grab==1) {z=DT_VERB_OFFSET+2*charsVerb(s[k])+(1==a?0:1);}
+ if(r-grab==1) {z=(V)(DT_VERB_OFFSET+2*charsVerb(s[k])+(1==a?0:1));}
else
{ j=atol(s+k);
i=DT_SPECIAL_VERB_OFFSET;
while(i < DT_SIZE && (!DT[i].text || j!= atol(DT[i].text)))i++;
- if(i<DT_SIZE){z=i+(1==a?0:1);}
+ if(i<DT_SIZE){z=(V)(i+(1==a?0:1));}
else R (I)PE; //no matching 0: 1: style verb. (if exists, we also allow eg 123: and -2: )
}
@@ -579,8 +579,8 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K*dict,K func) //IN string, string le
//save ':' if a []? + : y ;? ---> dyadic verb
//what passes for y? <--- anything that isn't an end/\0, except colon verb will go on to ex1 to the right and assign _n
)
- CS(MARK_ADVERB , z=DT_ADVERB_OFFSET+charsAdverb(s[k])+(r>1?3:0))
- CS(MARK_END , z=DT_OFFSET(end))
+ CS(MARK_ADVERB , z=(V)(DT_ADVERB_OFFSET+charsAdverb(s[k])+(r>1?3:0)))
+ CS(MARK_END , z=(V)(DT_OFFSET(end)))
}
if(!z) ; //TODO: handle null z, which can happen

0 comments on commit 4ae1649

Please sign in to comment.