示例#1
0
void GenerateVariable (AST* ast)
{
    //printf("variable\n");
    memory[NextIndex].instruction = PUSH;
    memory[NextIndex].op[0].i = searchV(ast->s)->value;
    free(ast->s);
    memory[NextIndex].instruction_ptr = table[memory[NextIndex].instruction];
    NextIndex++;
}
示例#2
0
void GenerateSetq (AST* ast,int i)
{
    Variable_Data_t* p;
    p = searchV (ast->s);
    free(ast->s);
    Generate (ast->LHS, i, null);
    //printf("setq\n");
    memory[NextIndex].instruction = SETQ;
    memory[NextIndex].instruction_ptr = table[memory[NextIndex].instruction];
    memory[NextIndex].op[0].adr = (cons_t*)p;
    NextIndex++;
}
示例#3
0
void addEdge(graph *g,int i,int j){
     vertex *I, *J;
     item* itemJ;
     
     //printf("Search for v%d\n",i);  //debug
     I=searchV(g,i);

     if (I == NULL) I=addNode(g,i);

     //printf("Search for v%d\n",j);  //debug
     J=searchV(g,j);
         
     if (J == NULL) J=addNode(g,j);

     if (searchI(I->successors,J)== NULL){
        itemJ = newItem(J);
        addHeadNodeList(itemJ,I->successors);
	(itemJ->vert)->nop++;
	//printf("Added new Edge\n"); // debug
      }
}
示例#4
0
vertex* addNode(graph *g, int i){
      
    vertex *newV;
    item *newI;
    
    newV=searchV(g,i);
    if (newV!= NULL) return newV;
    newV=newVertex(i);
    newI=newItem(newV);
    //if(isEmptyList(g->vertices)) printf("Empty graph!!\n");  // debug
    addHeadNodeList(newI, g->vertices);
    //if(isEmptyList(g->vertices)) printf("Empty graph after!!\n");  // debug
      
    return newV;
      
   }