MCPcopy Create free account
hub / github.com/anjo76/angelscript / DumpModule

Function DumpModule

sdk/tests/test_feature/source/test_dump.cpp:150–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void DumpModule(asIScriptModule *mod)
151{
152 int c, n;
153 asIScriptEngine *engine = mod->GetEngine();
154 stringstream s;
155
156 // Enumerate global functions
157 c = mod->GetFunctionCount();
158 for( n = 0; n < c; n++ )
159 {
160 asIScriptFunction *func = mod->GetFunctionByIndex(n);
161 s << "func: " << func->GetDeclaration() << endl;
162 }
163
164 // Enumerate object types
165 c = mod->GetObjectTypeCount();
166 for( n = 0; n < c; n++ )
167 {
168 DumpObjectType(s, mod->GetObjectTypeByIndex(n));
169 }
170
171 // Enumerate global variables
172 c = mod->GetGlobalVarCount();
173 for( n = 0; n < c; n++ )
174 {
175 s << "global: " << mod->GetGlobalVarDeclaration(n) << endl;
176 }
177
178 // Enumerate enums
179 c = mod->GetEnumCount();
180 for( n = 0; n < c; n++ )
181 {
182 asITypeInfo *ti = mod->GetEnumByIndex(n);
183
184 s << "enum: " << ti->GetName() << endl;
185
186 // List enum values
187 for( asUINT e = 0; e < ti->GetEnumValueCount(); e++ )
188 {
189 int value;
190 const char *name = ti->GetEnumValueByIndex(e, &value);
191 s << " " << name << " = " << value << endl;
192 }
193 }
194
195 // Enumerate type defs
196 c = mod->GetTypedefCount();
197 for( n = 0; n < c; n++ )
198 {
199 asITypeInfo *ti = mod->GetTypedefByIndex(n);
200
201 s << "typedef: " << ti->GetName() << " => " << engine->GetTypeDeclaration(ti->GetTypedefTypeId(), true) << endl;
202 }
203
204 // Enumerate imported functions
205 c = mod->GetImportedFunctionCount();
206 for( n = 0; n < c; n++ )
207 {

Callers 1

TestFunction · 0.85

Calls 15

DumpObjectTypeFunction · 0.85
GetFunctionCountMethod · 0.80
GetFunctionByIndexMethod · 0.80
GetDeclarationMethod · 0.80
GetGlobalVarCountMethod · 0.80
GetTypeDeclarationMethod · 0.80

Tested by

no test coverage detected