MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / print

Method print

src/liboslcomp/symtab.cpp:298–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296
297
298void
299SymbolTable::print ()
300{
301 if (TypeSpec::struct_list().size()) {
302 std::cout << "Structure table:\n";
303 int structid = 1;
304 for (auto&& s : TypeSpec::struct_list()) {
305 if (! s)
306 continue;
307 std::cout << " " << structid << ": struct " << s->mangled();
308 if (s->scope())
309 std::cout << " (" << s->name()
310 << " in scope " << s->scope() << ")";
311 std::cout << " :\n";
312 for (size_t i = 0; i < (size_t)s->numfields(); ++i) {
313 const StructSpec::FieldSpec & f (s->field(i));
314 std::cout << "\t" << f.name << " : "
315 << f.type.string() << "\n";
316 }
317 ++structid;
318 }
319 std::cout << "\n";
320 }
321
322 std::cout << "Symbol table:\n";
323 for (auto&& s : m_allsyms) {
324 if (s->is_structure())
325 continue;
326 std::cout << "\t" << s->mangled() << " : ";
327 if (s->is_structure()) {
328 std::cout << "struct " << s->typespec().structure() << " "
329 << s->typespec().structspec()->name();
330 } else {
331 std::cout << s->typespec().string();
332 }
333 if (s->scope())
334 std::cout << " (" << s->name() << " in scope "
335 << s->scope() << ")";
336 if (s->is_function()) {
337 const FunctionSymbol *f = (const FunctionSymbol *) s;
338 const char *args = f->argcodes().c_str();
339 int advance = 0;
340 args += advance;
341 std::cout << " function (" << m_comp.typelist_from_code(args) << ") ";
342 }
343 std::cout << "\n";
344 }
345 std::cout << "\n";
346}
347
348
349

Callers

nothing calls this directly

Calls 13

numfieldsMethod · 0.80
stringMethod · 0.80
structureMethod · 0.80
structspecMethod · 0.80
is_functionMethod · 0.80
c_strMethod · 0.80
argcodesMethod · 0.80
typelist_from_codeMethod · 0.80
sizeMethod · 0.45
mangledMethod · 0.45
scopeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected