spl.c
/* Push a new alias to the list */
Push a new alias to the list
Push a new alias to the list
void push_alias(char *name, int reg)
{
    struct alias *temp;
    if (lookup_constant(name) != NULL)
    {
        printf("\n%d: Alias name %s already used as symbolic contant!!\n", linecount, name);
        exit(0);
    }
    temp = lookup_alias(name);
    if (temp != NULL && temp->depth == depth)
    {
        printf("\n%d: Alias name %s already used as in the current block!!\n", linecount, name);
        exit(0);
    }
    else
    {
        temp = lookup_alias_reg(reg);
        if (temp != NULL && temp->depth == depth)
            strcpy(temp->name, name);
        else
        {
            temp = malloc(sizeof(struct alias));
            strcpy(temp->name, name);
            temp->reg = reg;
            temp->depth = depth;
            temp->next = root_alias;
            root_alias = temp;
        }
    }
}
void push_alias ( char * name , int reg ) { struct alias * temp ; if ( lookup_constant ( name ) != NULL ) { printf ( " \n \n " , linecount , name ) ; exit ( 0 ) ; } temp = lookup_alias ( name ) ; if ( temp != NULL && temp -> depth == depth ) { printf ( " \n \n " , linecount , name ) ; exit ( 0 ) ; } else { temp = lookup_alias_reg ( reg ) ; if ( temp != NULL && temp -> depth == depth ) strcpy ( temp -> name , name ) ; else { temp = malloc ( sizeof ( struct alias ) ) ; strcpy ( temp -> name , name ) ; temp -> reg = reg ; temp -> depth = depth ; temp -> next = root_alias ; root_alias = temp ; } } }
Push a new alias to the list
Push a new alias to the list