diff options
author | Adrian Thurston <thurston@complang.org> | 2014-12-20 13:12:20 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-12-20 13:12:20 -0500 |
commit | 67390d6e23bd4025a0025574d942d63c99006f57 (patch) | |
tree | 40bc997b7874918c194a672b75b0d62aad4364c5 /src/pdacodegen.cc | |
parent | 9153bb402e7f18df2c600a716021e004438aaf1e (diff) | |
download | colm-67390d6e23bd4025a0025574d942d63c99006f57.tar.gz |
downref trees when deleting a struct
Diffstat (limited to 'src/pdacodegen.cc')
-rw-r--r-- | src/pdacodegen.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pdacodegen.cc b/src/pdacodegen.cc index 96b1df1a..21518079 100644 --- a/src/pdacodegen.cc +++ b/src/pdacodegen.cc @@ -197,6 +197,18 @@ void PdaCodeGen::writeRuntimeData( RuntimeData *runtimeData, PdaTables *pdaTable } out << "\n};\n\n"; + + for ( int i = 0; i < runtimeData->numStructEls; i++ ) { + if ( runtimeData->selInfo[i].treesLen > 0 ) { + out << "static short struct_trees_" << i << "[] = {\n\t"; + + short *ti = runtimeData->selInfo[i].trees; + for ( int j = 0; j < runtimeData->selInfo[i].treesLen; j++ ) + out << ti[j] << ", "; + out << "\n};\n\n"; + } + } + /* * selInfo */ @@ -204,6 +216,14 @@ void PdaCodeGen::writeRuntimeData( RuntimeData *runtimeData, PdaTables *pdaTable for ( int i = 0; i < runtimeData->numStructEls; i++ ) { out << "\t{ "; out << runtimeData->selInfo[i].size << ", "; + + /* trees. */ + if ( runtimeData->selInfo[i].treesLen > 0 ) + out << "struct_trees_" << i << ", "; + else + out << "0, "; + out << runtimeData->selInfo[i].treesLen << ", "; + out << " }"; } out << "\n};\n\n"; |