new export options

This commit is contained in:
2018-07-29 22:07:21 +02:00
parent 8047a0487f
commit 8f76ce3569
7 changed files with 137 additions and 7 deletions
+7 -3
View File
@@ -36,6 +36,8 @@ class CStructArrayExporter extends BaseExporter
*/
protected function writeDocument()
{
$table = $this->table;
$any_bool = false;
$fields = array_map(function (Column $c) use (&$any_bool) {
$type = $c->type;
@@ -50,13 +52,15 @@ class CStructArrayExporter extends BaseExporter
return (object)['name' => $c->name, 'type' => $c->type, 'ctype' => $type, 'cname' => $name];
}, $this->columns);
$ctablename = $this->cify($this->table->name);
$ctablename = $this->cify($table->name);
// preamble
if ($any_bool) {
echo "#include <stdbool.h>\n\n";
}
echo "/*\n" . $this->getHeaderComment(' ') . "*/\n\n";
echo "struct " . $ctablename . " {\n";
foreach ($fields as $field) {
echo " " . $field->ctype . " " . $field->cname . ";\n";
@@ -74,7 +78,7 @@ class CStructArrayExporter extends BaseExporter
echo ",\n";
}
echo " {";
echo " { ";
$firstf = true;
foreach ($fields as $field) {
@@ -115,7 +119,7 @@ class CStructArrayExporter extends BaseExporter
break;
}
}
echo "}";
echo " }";
}
echo "\n};\n";