Esempio n. 1
0
AstDeclaration* SymbolsFind(char* identifier, int line)
{
    int current = VectorSize(symbols) - 1;
    for (; current >= 0; current--) {
        Symbol* symbol = (Symbol*)VectorGet(symbols, current);
        if (symbol->identifier == identifier)
            return symbol->declaration;
    }
    ErrorL(line, "symbol '%s' is not declared", identifier);
    return NULL;
}
Esempio n. 2
0
void CPntBufWindow::PointerL(const TPointerEvent &pointer,const TTime &)
	{
	switch(pointer.iType)
		{
		case TPointerEvent::EButton1Down:
			iDragging=ETrue;
			iGc->MoveTo(pointer.iPosition);
			if (iMode==2)
				{
				if (pointer.iModifiers&EModifierShift)
					{
					iDisabled=ETrue;
					iWin.DisablePointerMoveBuffer();
					}
				else if (pointer.iModifiers&EModifierCtrl)
					iDiscard=ETrue;
				}
			break;
		case TPointerEvent::EButton1Up:
			if (iDisabled)
				{
				iDisabled=EFalse;
				iWin.EnablePointerMoveBuffer();
				}
			iDiscard=EFalse;
			iGc->MoveTo(pointer.iPosition);
			iDragging=EFalse;
			break;
		case TPointerEvent::EDrag:
			if (iDragging && !iDisabled)
				ErrorL();
			break;
		case TPointerEvent::EMove:
			if (iDragging && !iDisabled)
				ErrorL();
			break;
		default:;
		}
	}
Esempio n. 3
0
void SymbolsAdd(char* identifier, AstDeclaration* declaration, int line)
{
    int current = 0;
    int last = 0;
    Symbol* new_symbol = NULL;

    if (!symbols)
        init();

    /* Verifies if this declaration shadows a symbol in the current block */
    if (!VectorEmpty(blocks))
        last = (int)(intptr_t)VectorPeek(blocks);
    for (current = VectorSize(symbols) - 1; current >= last; current--) {
        Symbol* symbol = (Symbol*)VectorGet(symbols, current);
        if (symbol->identifier == identifier)
            ErrorL(line, "symbol '%s' is already declared", identifier);
    }

    /* Inserts the the symbol */
    new_symbol = NEW(Symbol);
    new_symbol->identifier = identifier;
    new_symbol->declaration = declaration;
    VectorPush(symbols, new_symbol);
}