summaryrefslogtreecommitdiff
path: root/src/pdacodegen.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-12-20 13:12:20 -0500
committerAdrian Thurston <thurston@complang.org>2014-12-20 13:12:20 -0500
commit67390d6e23bd4025a0025574d942d63c99006f57 (patch)
tree40bc997b7874918c194a672b75b0d62aad4364c5 /src/pdacodegen.cc
parent9153bb402e7f18df2c600a716021e004438aaf1e (diff)
downloadcolm-67390d6e23bd4025a0025574d942d63c99006f57.tar.gz
downref trees when deleting a struct
Diffstat (limited to 'src/pdacodegen.cc')
-rw-r--r--src/pdacodegen.cc20
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";