Arrays debugged and working

git-svn-id: http://picoc.googlecode.com/svn/trunk@80 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-02-15 07:39:41 +00:00
parent 78e0ff8bc1
commit 2e545deb6a
3 changed files with 7 additions and 7 deletions

2
TODO
View file

@ -10,4 +10,4 @@ TODO
Also: Also:
* Do we really need OnHeap? Isn't every value on the stack anyway? * Do we really need OnHeap? Isn't every value on the stack anyway?
* Remove Var parameter from HeapPopStack() once we're certain it all works * Remove Var parameter from HeapPopStack() once we're certain it all works
* Clean up the two types of stack frame

View file

@ -209,7 +209,7 @@ int ParseValue(struct ParseState *Parser, struct Value **Result, int ResultOnHea
ProgramFail(Parser, "illegal array index"); ProgramFail(Parser, "illegal array index");
VariableStackPop(Parser, *Result); VariableStackPop(Parser, *Result);
LocalLValue = VariableAllocValueFromExistingData(Parser, (*Result)->Typ->FromType, (union AnyValue *)((void *)(&(*Result)->Val) + (*Result)->Typ->FromType->Sizeof * IntValue), TRUE, ResultOnHeap); *Result = VariableAllocValueFromExistingData(Parser, (*Result)->Typ->FromType, (union AnyValue *)((void *)(*Result)->Val + (*Result)->Typ->FromType->Sizeof * IntValue), TRUE, ResultOnHeap);
} }
} }
} }

10
picoc.h
View file

@ -150,11 +150,11 @@ union AnyValue
struct Value struct Value
{ {
struct ValueType *Typ; struct ValueType *Typ; /* the type of this value */
union AnyValue *Val; union AnyValue *Val; /* pointer to the AnyValue which holds the actual content */
char ValOnHeap; char ValOnHeap; /* the AnyValue is on the heap (but this Value is on the stack) */
char ValOnStack; char ValOnStack; /* the AnyValue is on the stack along with this Value */
char IsLValue; char IsLValue; /* is modifiable and is allocated somewhere we can usefully modify it */
}; };
/* hash table data structure */ /* hash table data structure */