Ejemplo n.º 1
0
void makeBegin(Register result, Register seq)
{
    Register tag = reg0;
    save(reg0);
    makeSymbol(tag, "begin");
    cons(result, tag, seq);
    restore(reg0);
}
Ejemplo n.º 2
0
void SAQwtPlotCurveItemSetWidget::setSymbol(QwtSymbol::Style style)
{
    if(nullptr == m_curveItem)
    {
        return;
    }
    QwtSymbol* newSymbol = makeSymbol(style);
    m_symbolSetButton->setEnabled(nullptr != newSymbol);
    m_curveItem->setSymbol(newSymbol);
}
Ejemplo n.º 3
0
static void makeLambda(Register result,
		       Register parameters, Register body)
{
    Register tag = reg0;
    save(reg0);
    makeSymbol(tag, "lambda");
    cons(result, parameters, body);
    cons(result, tag, result);
    restore(reg0);
}
Ejemplo n.º 4
0
void ifAlternative(Register result, Register exp)
{
    cdr(result, exp);
    cdr(result, result);
    cdr(result, result);
    if (!isNull(result))
	car(result, result);
    else
	makeSymbol(result, "false");
}
Ejemplo n.º 5
0
void makeProcedure(Register result, Register parameters,
		   Register body, Register env)
{
    Register tag = reg0;
    save(reg0);
    makeSymbol(tag, "procedure");
    cons(result, body, env);
    cons(result, parameters, result);
    cons(result, tag, result);
    restore(reg0);
}
Ejemplo n.º 6
0
void makeIf(Register result, Register predicate,
	    Register consequent, Register alternative)
{
    Register tag = reg0;
    save(reg0);
    makeSymbol(tag, "if");
    cons(result, consequent, alternative);
    cons(result, predicate, result);
    cons(result, tag, result);
    restore(reg0);
}
Ejemplo n.º 7
0
void FrTextSpans::clear()
{
   m_text = 0 ;
   m_spans = 0 ;
   m_symtab = FrSymbolTable::current() ;
   m_spancount = 0 ;
   m_textlength = 0 ;
   m_positions = 0 ;
   m_metadata.setStructType(makeSymbol("META")) ;
   m_sorted = true ;
   return ;
}
size_t parse1::insert(const string & str){
	string t_str = remove_white( remove_comments(str));
	if (isLabel(t_str)) {
		makeSymbol(t_str);
		return linked_list.size();
	}else if(is_at(t_str)){
		makeSplit(t_str);
		return linked_list.size();
	}
	if (t_str == "") { return linked_list.size();}
	else {linked_list.push_back(t_str);}
	return linked_list.size();
}
Ejemplo n.º 9
0
Object loadFile(char* fileName)
{
    if ((yyin = fopen(fileName, "r" )) == NULL) {
	yyrestart(stdin);
	return makeNull();
    }

    while (1) {
	setReg(regExp, read());
	if (isEOF(getReg(regExp)))
	    break;
	eval();
    }
    
    yyrestart(stdin);

    return makeSymbol("ok");
}
Ejemplo n.º 10
0
void loadFile(Register reg, char* fileName)
{
    if ((yyin = fopen(fileName, "r" )) == NULL) {
	yyrestart(stdin);
	makeNull(reg);
    }

    while (1) {
	read(reg);
	if (isEOF(reg))
	    break;
#if 0
	eval();
#endif
    }
    
    yyrestart(stdin);

    makeSymbol(reg, "ok");
}
Ejemplo n.º 11
0
// Internal ctor, used to create non-root nodes
ClassLattice::ClassLattice( dr_handle hdl, Module * mod, char * name,
                            ClassList * vlist, dr_access acc,
                            dr_virtuality virt, bool relaxVirt, int level )
        : _handle( hdl )
        , _module( mod )
        , _name( name )
        , _basesLoaded( FALSE )
        , _derivedsLoaded( FALSE )
        , _flatClasses( vlist )
        , _effAccess( acc )
        , _virtual( (VirtLevel)virt )
        , _relaxedVirt(relaxVirt)
        , _level( level )
//-------------------------------------------------------------------------
{
    _flatClasses->add( this );

    if( _name == NULL ) {               /* OPTME this is expensive */
        Symbol * sym = makeSymbol();
        _name = WBRStrDup( sym->name() );
        delete sym;
    }
}
Ejemplo n.º 12
0
//Determines if block is well-formed
int block(char list[][20], int size, char* token, int i)
{
    //Case where block begins with constant declaration
    if(atoi(token) == constsym){
        do
        {
            i++;
            token = list[i];

            //Do not accept constant without identifier
            if(atoi(token) != identsym)
            {
                error(0); err = i; err2 = 0;
                return -1;
            }

            char* name = list[i+1];

            i+=2;
            token = list[i];

            //Constant must be followed by equals
            if(atoi(token) != eqsym)
            {
                error(1); err = i; err2 = 1;
                return -1;
            }

            i++;
            token = list[i];

            //Constant must be assigned to a number
            if (atoi(token) != numbersym)
            {
                error(2); err = i; err2 = 2;
                return -1;
            }

            int val = atoi(list[i+1]);
            i+=2;
            token = list[i];

            //If constant is well-formed it is added to symbol table
            if (atoi(token) == commasym || atoi(token) == semicolonsym)
                makeSymbol(1, name, lev, val);

        }while(atoi(token) == commasym); //Continue while more constants exist
        if(atoi(token) != semicolonsym)
        {
            error(3); err = i; err2 = 3;
            return -1;
        }

        i++;
        token = list[i];
    }

    //Determines if int declarations are well-formed
    if(atoi(token) == intsym)
    {
        do{
            i++;
            token = list[i];

            //Int must have identifier
            if(atoi(token) != identsym)
            {
                error(0); err = i; err2 = 0;
                return -1;
            }

            char* name = list[i+1];
            i+=2;
            token = list[i];

            //Adds int to symbol table
            if (atoi(token) == commasym || atoi(token) == semicolonsym)
                makeSymbol(2, name, lev, 0);

        } while(atoi(token) == commasym); //Continues while more int declarations
        if(atoi(token) != semicolonsym)
        {
            error(3); err = i; err2 = 3;
            return -1;
        }

        i++;
        token = list[i];
    }
    while(atoi(token) == procsym) //Accepts all well-formed procedure declarations
    {
        i++;
        token = list[i];

        //Procedure must have identifier
        if(atoi(token) != identsym)
        {
            error(0); err = i; err2 = 0;
            return -1;
        }
        char* name = list[i+1];

        //Add procedure to symbol table
        makeSymbol(3, name, lev, cx+1);
        printf("%s", name);
        i+=2;
        token = list[i];

        //Procedure must end with semicolon
        if(atoi(token) != semicolonsym)
        {
            error(3); err = i; err2 = 3;
            return -1;
        }
        i++;
        token = list[i];

        //Procedure must have a well-formed block
        lev++;
        int tempCX = cx;
        emit(JMP, 0, 0, i);
        i = block(list, size, token, i);
        emit(OPR, 0, 0, i);
        operations[tempCX].m = cx;
        lev--;
        if (i == -1)
            return -1;
        token = list[i];

        //Block must end with semi-colon
        if(atoi(token) != semicolonsym)
        {
            error(3); err = i; err2 = 3;
            return -1;
        }
        i++;
        token = list[i];
    }

    //Block may have a statement
    i = statement(list, size, token, i);
    if (i == -1)
        return -1;

    return i;
}