static void DoDumpType( TYPEPTR realtype, const char *symname, STRCHUNK *pch ) { type_modifiers pointer_flags; TYPEPTR typ; realtype = TrueType( realtype ); DumpBaseType( realtype, pch ); DumpDecl( realtype, NULL, pch ); if( symname ) ChunkSaveStr( pch, symname ); if( realtype->decl_type == TYPE_POINTER ) { if( realtype->u.p.decl_flags & FLAG_WAS_ARRAY ) { typ = Object( realtype ); if( typ->decl_type != TYPE_ARRAY ) { ChunkSaveStr( pch, "[]" ); } } } for( typ = realtype; typ != NULL; typ = Object( typ ) ) { if( typ->decl_type == TYPE_TYPEDEF ) break; pointer_flags = 0; while( typ->decl_type == TYPE_POINTER ) { pointer_flags = typ->u.p.decl_flags; typ = Object( typ ); } if( typ->decl_type == TYPE_ARRAY || typ->decl_type == TYPE_FUNCTION ) { DumpTail( realtype, NULL, pointer_flags, pch ); break; } } }
static void DumpParmList( TYPEPTR *parm, SYMPTR funcsym, STRCHUNK *pch ) { TYPEPTR typ; int parm_num; SYM_HANDLE sym_handle; SYM_ENTRY sym; char *sym_name; char temp_name[20]; if( parm == NULL ) { ChunkSaveStr( pch, "void" ); } else { parm_num = 1; if( funcsym != NULL ) { sym_handle = funcsym->u.func.parms; } else { sym_handle = 0; } for( ;; ) { typ = *parm; if( typ == NULL ) break; typ = TrueType( typ ); if( funcsym != NULL ) { if( funcsym->flags & SYM_OLD_STYLE_FUNC ) { typ = DefArgPromotion( typ ); } } sym_name = NULL; if( sym_handle != 0 ) { SymGet( &sym, sym_handle ); sym_handle = sym.handle; sym_name = sym.name; } else { if( typ->decl_type != TYPE_VOID && typ->decl_type != TYPE_DOT_DOT_DOT ) { sym_name = temp_name; sprintf( temp_name, "__p%d", parm_num ); } } DoDumpType( typ, sym_name, pch ); ++parm; if( *parm != NULL ) { ChunkSaveChar( pch, ',' ); } ++parm_num; } } }
static void DumpParmTags( TYPEPTR *parm, FILE *fp ) { TYPEPTR typ; STRCHUNK chunk; char *result; if( parm != NULL ) { for( ; (typ = *parm) != NULL; ) { typ = TrueType( typ ); if( typ->decl_type == TYPE_STRUCT || typ->decl_type == TYPE_UNION ) { ChunkInit(&chunk); ChunkSaveStrWord( &chunk, CTypeNames[typ->decl_type] ); DumpTagName( typ->u.tag->name, &chunk ); result = ChunkToStr( &chunk ); fprintf( fp, "%s;\n", result ); CMemFree( result ); } ++parm; } } }
static TYPEPTR Object( TYPEPTR typ ) { return( TrueType( typ->object ) ); }