Example #1
0
int GetExpression()
{
	EVAL Part1;

	ExpType	= EXP_numeric;
	ExpSection = 0;
	ExpResolved = 0;
	ExpFlags = REF_null;

	CodeRef = 0;
	CodeValue = 0;

	ExpIsPure = 0;

	ClearLastSymbolRef();

	ClearPart(&Part1);
	assign(&Part1);
	SkipWhiteSpace();
	
	if (CodeRef)
		if (CodeValue != Part1.Value)
			Error(Error_Skip, "Illegal function pointer manipulation");
		
	return Part1.Value;
}
Example #2
0
int GetExpPure()
{
	EVAL Part1;

	ExpType	= EXP_numeric;
	ExpSection = 0;
	ExpResolved = 0;
	ExpFlags = REF_null;

	CodeRef = 0;
	CodeValue = 0;

	ExpIsPure = 1;

	ClearLastSymbolRef();

	ClearPart(&Part1);
	assign(&Part1);
	SkipWhiteSpace();

	ExpIsPure = 0;
		
	return Part1.Value;
}
Example #3
0
int GetEnumValue(char *ThisName)
{
    SYMBOL	*theSym;
    int 	scope;

    ClearLastSymbolRef();

    // Test to see if this symbol is a thunk alias

    if (ThisName[0] == '%')
    {
        int v;

        PushTokenPtr(ThisName, 0);

        if (!Token("%"))
            Error(Error_Fatal, "Missing Thunk Delimiter");

        v = GetDecNum(5);

        if (GetDecNumDigitCount() == 0)
            Error(Error_Fatal, "Missing Thunk Number");

        PopTokenPtr();

        theSym = GetThunk(v);

        if (!theSym)
        {
            if (Pass == 1)
                return 0;

            printf("Bad thunk!!\n");
            doCannotEvaluate(ThisName+1);
            return 0;
        }

        SetLastSymbolRef(theSym);
        return theSym->Value;
    }

    // Now deal with all other symbols

    theSym = FindSymbols(ThisName,section_Enum,section_Enum, LocalScope);

    if (theSym)			// Variable was found in local scope
    {
        // Add one more reference to this symbol

        //theSym->Ref++;

        SetLastSymbolRef(theSym);

        // Save the symbols label type

        //EnumFunction = theSym->LabelType;
        return theSym->Value;
    }
    else
    {
        // Variable wasnt found is local scope, so check global scope

        theSym = FindSymbols(ThisName,section_Enum,section_Enum, 0);

        if (theSym)
        {
            // Found a global, so extract the scope of this global

            scope = theSym->Value;

            theSym = FindSymbols(ThisName,section_Enum,section_Enum, scope);

            if (theSym)
            {
                // Add one more reference to this symbol

                //theSym->Ref++;
                SetLastSymbolRef(theSym);

                // Save the symbols label type

                //EnumFunction = theSym->LabelType;
                return theSym->Value;
            }
        }
    }

    // Dont worry if a global doesnt exist in pass 1

    if (Pass == 1)
        return 0;

    // Do worry in other passes

    doCannotEvaluate(ThisName);
    return 0;
}