Ejemplo n.º 1
0
Archivo: List.c Proyecto: BigEd/Cores
void put_ty(TYP *tp)
{       if(tp == 0)
                return;
        switch(tp->type) {
				case bt_byte:
                        fprintf(list,"Byte");
                        break;
                case bt_char:
                        fprintf(list,"Char");
                        break;
                case bt_short:
                        fprintf(list,"Short");
                        break;
                case bt_enum:
                        fprintf(list,"enum ");
                        goto ucont;
                case bt_long:
                        fprintf(list,"Long");
                        break;
                case bt_unsigned:
                        fprintf(list,"unsigned long");
                        break;
                case bt_float:
                        fprintf(list,"Float");
                        break;
                case bt_double:
                        fprintf(list,"Double");
                        break;
                case bt_pointer:
                        if( tp->val_flag == 0)
                                fprintf(list,"Pointer to ");
                        else
                                fprintf(list,"Array of ");
                        put_ty(tp->btp);
                        break;
                case bt_union:
                        fprintf(list,"union ");
                        goto ucont;
                case bt_struct:
                        fprintf(list,"struct ");
ucont:                  if(tp->sname == 0)
                                fprintf(list,"<no name> ");
                        else
                                fprintf(list,"%s ",tp->sname);
                        break;
                case bt_ifunc:
                case bt_func:
                        fprintf(list,"Function returning ");
                        put_ty(tp->btp);
                        break;
                }
}
Ejemplo n.º 2
0
void list_var(SYM *sp, int i)
{
	TypeArray *ta;
	
		int     j;
        for(j = i; j; --j)
                lfs.printf("    ");
		if (sp->name->length()== 0)
			lfs.printf("%-10s =%06x ","<unnamed>",(unsigned int)sp->value.u);
		else {
			lfs.printf("%-10s =%06x",(char *)sp->name->c_str(),(unsigned int)sp->value.u);
			if (sp->tp)
				if (sp->tp->bit_width != -1)
					lfs.printf("  %d %d",sp->tp->bit_offset,sp->tp->bit_width);
		}
//			if (sp->IsPascal) ofs.printf("\tpascal ");
        if( sp->storage_class == sc_external)
                ofs.printf("\textern\t%s\n",(char *)sp->name->c_str());
        else if( sp->storage_class == sc_global )
                ofs.printf(";\tglobal\t%s\n",(char *)sp->name->c_str());
		put_typedef(sp->storage_class==sc_typedef);
        put_sc(sp->storage_class);
        put_ty(sp->tp);
        lfs.printf("\n");
        if(sp->tp == 0)
                return;
    if (sp->tp) {
  		if (sp->tp->type==bt_ifunc || sp->tp->type==bt_func) {
  			lfs.printf("\t\tParameters:\n\t\t\t");
  			ta = sp->GetProtoTypes();
  			ta->Print(&lfs);
  			if (ta)
  				delete ta;
			lfs.printf("Stack Space:\n\t\t");
			lfs.printf("Argbot: %d\n\t\t", sp->argbot);
			lfs.printf("Tmpbot: %d\n\t\t", sp->tempbot);
			lfs.printf("Stkspc: %d\n\t\t", sp->stkspace);
  		}
	  }
	  if (sp->tp) {
        if((sp->tp->type == bt_struct || sp->tp->type == bt_union || sp->tp->type==bt_class) &&
                sp->storage_class == sc_type)
                ListTable(&(sp->tp->lst),i+1);
    }
}
Ejemplo n.º 3
0
Archivo: List.c Proyecto: BigEd/Cores
void list_var(SYM *sp, int i)
{       int     j;
        for(j = i; j; --j)
                fprintf(list,"    ");
		if (sp->name == NULL)
			fprintf(list,"%-10s =%06x ","<unnamed>",sp->value.u);
		else
			fprintf(list,"%-10s =%06x ",sp->name,sp->value.u);
        if( sp->storage_class == sc_external)
                fprintf(output,"\textern\t%s\n",sp->name);
        else if( sp->storage_class == sc_global )
                fprintf(output,";\tglobal\t%s\n",sp->name);
		put_typedef(sp->storage_class==sc_typedef);
        put_sc(sp->storage_class);
        put_ty(sp->tp);
        fprintf(list,"\n");
        if(sp->tp == 0)
                return;
        if((sp->tp->type == bt_struct || sp->tp->type == bt_union) &&
                sp->storage_class == sc_type)
                ListTable(&(sp->tp->lst),i+1);
}
Ejemplo n.º 4
0
/* Put the type */
void put_ty(TYP *tp)
{
    if ((tp == 0) || (!prm_listfile))
        return ;
    switch (tp->type)
    {
        case bt_matchall:
            fprintf(listFile, "Undefined");
            break;
        case bt_char:
            fprintf(listFile, "Char");
            break;
        case bt_bool:
            fprintf(listFile, "Bool");
            break;
        case bt_short:
            fprintf(listFile, "Short");
            break;
        case bt_enum:
            fprintf(listFile, "enum ");
            goto ucont;
        case bt_long:
            fprintf(listFile, "Long");
            break;
        case bt_longlong:
            fprintf(listFile, "Long Long");
            break;
        case bt_int:
            fprintf(listFile, "Int");
            break;
        case bt_unsignedchar:
            fprintf(listFile, "Unsigned Char");
            break;
        case bt_unsignedshort:
            fprintf(listFile, "Unsigned Short");
            break;
        case bt_unsigned:
            fprintf(listFile, "Unsigned");
            break;
        case bt_unsignedlong:
            fprintf(listFile, "Unsigned Long");
            break;
        case bt_unsignedlonglong:
            fprintf(listFile, "Unsigned Long Long");
            break;
        case bt_fcomplex:
            fprintf(listFile, "Float Complex");
            break;
        case bt_rcomplex:
            fprintf(listFile, "Double Complex");
            break;
        case bt_lrcomplex:
            fprintf(listFile, "Long Double Complex");
            break;
        case bt_fimaginary:
            fprintf(listFile, "Float Imaginary");
            break;
        case bt_rimaginary:
            fprintf(listFile, "Double Imaginary");
            break;
        case bt_lrimaginary:
            fprintf(listFile, "Long Double Imaginary");
            break;
        case bt_float:
            fprintf(listFile, "Float");
            break;
        case bt_double:
            fprintf(listFile, "Double");
            break;
        case bt_longdouble:
            fprintf(listFile, "Long Double");
            break;
        case bt_farpointer:
            fprintf(listFile, "Far ");
            // fall through
        case bt_pointer:
            if (tp->val_flag == 0)
                fprintf(listFile, "Pointer to ");
            else
                if (tp->val_flag & VARARRAY) {
                    fprintf(listFile,"VArray of ");
                    tp = tp->btp;
                } else
                    fprintf(listFile, "Array of ");
            put_ty(tp->btp);
            break;
        case bt_union:
            fprintf(listFile, "union ");
            goto ucont;
            case bt_ref:
                fprintf(listFile, "Reference to ");
                put_ty(tp->btp);
                break;
            case bt_memberptr:
                fprintf(listFile, "Member Pointer to %s::", tp->sp->name);
                put_ty(tp->btp->btp);
                break;
            case bt_class:
                fprintf(listFile, "class ");
                goto ucont;
        case bt_struct:
            fprintf(listFile, "struct ");
            ucont: if (tp->sp == 0)
                fprintf(listFile, tn_unnamed);
            else
                fprintf(listFile, "%s ", unmangledname(tp->sp->name));
            break;
        case bt_void:
            fprintf(listFile, "Void");
            break;
        case bt_ifunc:
        case bt_func:
            fprintf(listFile, "Function returning ");
            put_ty(tp->btp);
            break;
    }
    if (tp->startbit !=  - 1)
        fprintf(listFile, "  Bits %d to %d", tp->startbit, tp->startbit + tp
            ->bits - 1);
}
Ejemplo n.º 5
0
/* List a variable */
void list_var(SYM *sp, int i)
{
    int j;
    long val;
    if (!prm_listfile)
        return ;
    if (sp->dontlist)
        return;
    if (sp->tp->type == bt_defunc)
    {
        sp = sp->tp->lst.head;
        while (sp)
        {
            list_var(sp, 0);
            sp = sp->next;
        }
        return ;
    }
    for (j = i; j; --j)
        fprintf(listFile, "    ");
    if ((sp->storage_class == sc_auto || sp->storage_class == sc_autoreg) &&
        !sp->inreg)
        val = (long)getautoval(sp->value.i);
    else if (sp->storage_class == sc_static || sp->storage_class == sc_global)
        val = sp->offset;
    else
        val = sp->value.u;
    fprintf(listFile,"Identifier:   %s\n    ", unmangledname(sp->name));
    for (j = i; j; --j)
        fprintf(listFile, "    ");
    if (sp->inreg) {
        fprintf(listFile,"Register: %-3s      ",
            registers[( - val) & 255]);
    }
    else
        fprintf(listFile,"Offset:   %08X ", val);
    fprintf(listFile,"Storage: ");
    if (sp->tp->type == bt_ifunc)
        if (sp->value.classdata.cppflags &PF_INLINE)
            fprintf(listFile,"%-7s","inline");
        else
            fprintf(listFile,"%-7s","code");
    else if (sp->storage_class == sc_auto)
        if (sp->inreg)
            fprintf(listFile,"%-7s","reg");
        else
            fprintf(listFile,"%-7s","stack");
    else if (sp->storage_class == sc_global || sp->storage_class == sc_static)
        if ((sp->tp->cflags &DF_CONST) && !(sp->tp->cflags &DF_VOL))
            fprintf(listFile,"%-7s","const");
        else if (sp->init)
            fprintf(listFile,"%-7s","data");
        else
            fprintf(listFile,"%-7s","bss");
    else if (sp->storage_class == sc_const)
        fprintf(listFile,"%-7s","inline");
    else
        fprintf(listFile,"%-7s","none");
    put_sc(sp->storage_class);
    put_ty(sp->tp);
    fprintf(listFile, "\n");
    if (sp->tp == 0)
        return ;
    if (isstructured(sp->tp) && sp->storage_class == sc_type)
        list_table(&(sp->tp->lst), i + 1);
}
Ejemplo n.º 6
0
/* List a variable */
void list_var(SYMBOL *sp, int i)
{
    int j;
    long val;
    if (!cparams.prm_listfile)
        return ;
    if (sp->dontlist)
        return;
    if (sp->tp->type == bt_aggregate)
    {
        HASHREC *hr = sp->tp->syms->table[0];
        while (hr)
        {
            sp = (SYMBOL *)hr->p;
            list_var(sp, 0);
            hr = hr->next;
        }
        return ;
    }
    for (j = i; j; --j)
        fprintf(listFile, "    ");
    if (sp->storage_class == sc_auto && !sp->regmode)
        val = (long)getautoval(sp->offset);
    else
        val = sp->value.u;
    fprintf(listFile,"Identifier:   %s\n    ", unmangledname(sp->name));
    for (j = i; j; --j)
        fprintf(listFile, "    ");
    if (sp->regmode == 1) {
        fprintf(listFile,"Register: %-3s&     ",lookupRegName((-sp->offset) & 255));
    }
    else if (sp->regmode == 2) {
        fprintf(listFile,"Register: %-3s      ",lookupRegName((-sp->offset) & 255));
    }
    else
        fprintf(listFile,"Offset:   %08lX ", val);
    fprintf(listFile,"Storage: ");
    if (sp->tp->type == bt_ifunc)
        if (sp->isInline && !sp->noinline)
            fprintf(listFile,"%-7s","inline");
        else
            fprintf(listFile,"%-7s","code");
    else if (sp->storage_class == sc_auto)
        if (sp->regmode)
            fprintf(listFile,"%-7s","reg");
        else
            fprintf(listFile,"%-7s","stack");
    else if (sp->storage_class == sc_global || sp->storage_class == sc_static 
             || sp->storage_class == sc_localstatic)
        if (isconst(sp->tp))
            fprintf(listFile,"%-7s","const");
        else if (sp->init)
            fprintf(listFile,"%-7s","data");
        else
            fprintf(listFile,"%-7s","bss");
    else if (sp->storage_class == sc_constant || sp->storage_class == sc_enumconstant)
        fprintf(listFile,"%-7s","constant");
    else
        fprintf(listFile,"%-7s","none");
    put_sc(sp->storage_class);
    put_ty(sp->tp);
    fprintf(listFile, "\n");
    if (sp->tp == 0)
        return ;
    if (isstructured(sp->tp) && sp->storage_class == sc_type)
        list_table(sp->tp->syms, i + 1);
}
Ejemplo n.º 7
0
/* Put the type */
void put_ty(TYPE *tp)
{
    if ((tp == 0) || (!cparams.prm_listfile))
        return ;
    switch (tp->type)
    {
        case bt_any:
            fprintf(listFile, "Undefined");
            break;
        case bt_char:
            fprintf(listFile, "Char");
            break;
        case bt_bool:
            fprintf(listFile, "Bool");
            break;
        case bt_bit:
            fprintf(listFile, "Bit");
            break;
        case bt_short:
            fprintf(listFile, "Short");
            break;
        case bt_wchar_t:
            fprintf(listFile, "Wchar_t");
            break;
        case bt_enum:
            fprintf(listFile, "enum ");
            goto ucont;
        case bt_long:
            fprintf(listFile, "Long");
            break;
        case bt_long_long:
            fprintf(listFile, "Long Long");
            break;
        case bt_int:
            fprintf(listFile, "Int");
            break;
        case bt_char16_t:
            fprintf(listFile, "Char16_t");
            break;
        case bt_char32_t:
            fprintf(listFile, "Char32_t");
            break;
        case bt_signed_char:
            fprintf(listFile, "Signed Char");
            break;
        case bt_unsigned_char:
            fprintf(listFile, "Unsigned Char");
            break;
        case bt_unsigned_short:
            fprintf(listFile, "Unsigned Short");
            break;
        case bt_unsigned:
            fprintf(listFile, "Unsigned");
            break;
        case bt_unsigned_long:
            fprintf(listFile, "Unsigned Long");
            break;
        case bt_unsigned_long_long:
            fprintf(listFile, "Unsigned Long Long");
            break;
        case bt_float_complex:
            fprintf(listFile, "Float Complex");
            break;
        case bt_double_complex:
            fprintf(listFile, "Double Complex");
            break;
        case bt_long_double_complex:
            fprintf(listFile, "Long Double Complex");
            break;
        case bt_float_imaginary:
            fprintf(listFile, "Float Imaginary");
            break;
        case bt_double_imaginary:
            fprintf(listFile, "Double Imaginary");
            break;
        case bt_long_double_imaginary:
            fprintf(listFile, "Long Double Imaginary");
            break;
        case bt_float:
            fprintf(listFile, "Float");
            break;
        case bt_double:
            fprintf(listFile, "Double");
            break;
        case bt_long_double:
            fprintf(listFile, "Long Double");
            break;
        case bt_far:
            fprintf(listFile, "Far ");
            /* fall through*/
        case bt_pointer:
            if (!tp->vla && !tp->array)
                fprintf(listFile, "Pointer to ");
            else
                if (tp->vla) {
                    fprintf(listFile,"VArray of ");
                    tp = tp->btp;
                } else
                    fprintf(listFile, "Array of ");
            put_ty(tp->btp);
            break;
        case bt_union:
            fprintf(listFile, "union ");
            goto ucont;
            case bt_lref:
                fprintf(listFile, "Reference to ");
                put_ty(tp->btp);
                break;
            case bt_rref:
                fprintf(listFile, "r-value Reference to ");
                put_ty(tp->btp);
                break;
            case bt_memberptr:
                fprintf(listFile, "Member Pointer to %s::", tp->sp->name);
                put_ty(tp->btp->btp);
                break;
            case bt_class:
                fprintf(listFile, "class ");
                goto ucont;
        case bt_struct:
            fprintf(listFile, "struct ");
            ucont: if (tp->sp == 0)
                fprintf(listFile, "%s", tn_unnamed);
            else
                fprintf(listFile, "%s ", unmangledname(tp->sp->name));
            break;
        case bt_void:
            fprintf(listFile, "Void");
            break;
        case bt_ifunc:
        case bt_func:
            fprintf(listFile, "Function returning ");
            put_ty(tp->btp);
            break;
        default:
            fprintf(listFile, "???");
            break;
            
    }
    if (tp->bits !=  0)
        fprintf(listFile, "  Bits %d to %d", tp->startbit, tp->startbit + tp
            ->bits - 1);
}
Ejemplo n.º 8
0
void put_ty(TYP *tp)
{
		if(tp == 0)
                return;
        switch(tp->type) {
                case bt_exception:
                        lfs.printf("Exception");
                        break;
				case bt_byte:
                        lfs.printf("Byte");
                        break;
				case bt_ubyte:
                        lfs.printf("Unsigned Byte");
                        break;
                case bt_char:
                        lfs.printf("Char");
                        break;
                case bt_short:
                        lfs.printf("Short");
                        break;
                case bt_enum:
                        lfs.printf("enum ");
                        goto ucont;
                case bt_long:
                        lfs.printf("Long");
                        break;
                case bt_unsigned:
                        lfs.printf("unsigned long");
                        break;
                case bt_float:
                        lfs.printf("Float");
                        break;
                case bt_double:
                        lfs.printf("Double");
                        break;
                case bt_pointer:
                        if( tp->val_flag == 0)
                                lfs.printf("Pointer to ");
                        else
                                lfs.printf("Array of ");
                        put_ty(tp->GetBtp());
                        break;
                case bt_class:
                        lfs.printf("class ");
                        goto ucont;
                case bt_union:
                        lfs.printf("union ");
                        goto ucont;
                case bt_struct:
                        lfs.printf("struct ");
ucont:                  if(tp->sname->length() == 0)
                                lfs.printf("<no name> ");
                        else
                                lfs.printf("%s ",(char *)tp->sname->c_str());
                        break;
                case bt_ifunc:
                case bt_func:
                        lfs.printf("Function returning ");
                        put_ty(tp->GetBtp());
                        break;
                }
}