bool addVarToStack (const variable & va, variableStack * & thisStack) {
	variableStack * newStack = new variableStack;
	if (! checkNew (newStack)) return false;

	if (! copyMain (va, newStack -> thisVar)) return false;
	newStack -> next = thisStack;
	thisStack = newStack;
	return true;
}
Beispiel #2
0
bool addVarToStack(const Variable &va, VariableStack *&thisStack) {
	VariableStack *newStack = new VariableStack;
	if (!checkNew(newStack))
		return false;

	if (!copyMain(va, newStack->thisVar))
		return false;
	newStack->next = thisStack;
	thisStack = newStack;
	//debugC(2, kSludgeDebugStackMachine, "Variable %s was added to stack", getTextFromAnyVar(va));
	return true;
}
bool makeFastArrayFromStack (variable & to, const stackHandler * stacky) {
	int size = stackSize (stacky);
	if (! makeFastArraySize (to, size)) return false;

	// Now let's fill up the new array

	variableStack * allV = stacky -> first;
	size = 0;
	while (allV) {
		copyMain (allV -> thisVar, to.varData.fastArray -> fastVariables[size]);
		size ++;
		allV = allV -> next;
	}
	return true;
}
bool copyVariable (const variable & from, variable & to) {
	unlinkVar (to);
	return copyMain (from, to);
}