MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Disassemble

Method Disassemble

neo/game/script/Script_Program.cpp:1718–1743  ·  view source on GitHub ↗

============== idProgram::Disassemble ============== */

Source from the content-addressed store, hash-verified

1716==============
1717*/
1718void idProgram::Disassemble( void ) const {
1719 int i;
1720 int instructionPointer;
1721 const function_t *func;
1722 idFile *file;
1723
1724 file = fileSystem->OpenFileByMode( "script/disasm.txt", FS_WRITE );
1725
1726 for( i = 0; i < functions.Num(); i++ ) {
1727 func = &functions[ i ];
1728 if ( func->eventdef ) {
1729 // skip eventdefs
1730 continue;
1731 }
1732
1733 file->Printf( "\nfunction %s() %d stack used, %d parms, %d locals {\n", func->Name(), func->locals, func->parmTotal, func->locals - func->parmTotal );
1734
1735 for( instructionPointer = 0; instructionPointer < func->numStatements; instructionPointer++ ) {
1736 DisassembleStatement( file, func->firstStatement + instructionPointer );
1737 }
1738
1739 file->Printf( "}\n" );
1740 }
1741
1742 fileSystem->CloseFile( file );
1743}
1744
1745/*
1746==============

Callers 1

Cmd_DisasmScript_fFunction · 0.45

Calls 5

OpenFileByModeMethod · 0.80
CloseFileMethod · 0.80
NumMethod · 0.45
PrintfMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected