fix naming bug, add test data

This commit is contained in:
zongor 2024-05-27 21:21:21 -04:00
parent 6dded3befe
commit 8ca89a09d2
2 changed files with 9 additions and 2 deletions
tools/js-class-c-struct-transpiler

View File

@ -1 +1,8 @@
bun run ../transpile.js -S schema.json -j out/ -c out/ -s out/
bun run ../transpile.js -S schema.json -j out/ -c out/ -s out/;
rm -rf out/test.db;
sqlite3 out/test.db < out/types.sql;
echo 'INSERT INTO Vector3 (x, y, z) VALUES (-9.0, 9.0, 4.0);' | sqlite3 out/test.db;
echo 'INSERT INTO Vector3 (x, y, z) VALUES (9.0, 9.0, 0.0);' | sqlite3 out/test.db;
echo 'INSERT INTO Vector3 (x, y, z) VALUES (0.0, 1.0, 0.0);' | sqlite3 out/test.db;
echo 'INSERT INTO Camera3D (position_vector3_id, target_vector3_id, up_vector3_id, fovy, projection) VALUES (1, 2, 3, 60.0, 0);' | sqlite3 out/test.db;
echo "INSERT INTO Entity (Name, camera_camera3d_id, Strength, Endurance, Intelligence, Wisdom, Charisma, Faith, Artisan, Metalworking, Alchemy, Engineering, Culinary, Ranged, Melee, Acrobatics, Prestidigitation, Language, Medicine, Thaumatology, Theology, Fishing, Mining, Survival, Gardening, History, Perception, Luck, Stealth, Attractiveness, Affluence, Notoriety) VALUES ('Zongor',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,42,1,1,1,1);" | sqlite3 out/test.db;

View File

@ -142,7 +142,7 @@ for (const type of Object.keys(schema)) {
set ${prop}(v) {
this._data.set(this._encoder.encode(v), ${parseInt(offset)});
}`;
sqlData += `, ${propType} TEXT`;
sqlData += `, ${prop} TEXT`;
cData += `
char ${prop}[${iSize}];`;
break;