Commit Graph

31 Commits (736ed038571f5bb6b2a57ee6b35555af35b75dbe)

Author SHA1 Message Date
Gerard Krol 71bc279c9e Fix some spelling errors in debug messages and comments. Patch by Paul Wise <pabs3>.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6832 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-11 11:51:40 +00:00
Giel van Schijndel 6e1d019403 * Update SQLite stats database
* Fix loading of stats from the SQLite database (utilised in the campaign)

This fixes #276 and #269.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6670 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-21 21:09:37 +00:00
Giel van Schijndel 57de43c140 * Generate CREATE VIEW statements in the SQL schema
* Use these VIEWs instead of rather complicated SELECT statements in the C SQLite loading code

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6646 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-15 12:32:29 +00:00
Giel van Schijndel 3d92823e49 * Use the more readable $arrayreference->[$index] and $hashreference->{$key} instead of ${$arrayreference}[$index] and ${$hashreference}{$key} respectively
* Use 'my $var = $expression || "";' instead of 'my $var = ""; $var = $expression if $expression;'

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6366 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-23 13:32:02 +00:00
Giel van Schijndel 8f6eb3c17c Use || as shortcut operator (I used "or" before, which didn't work as expected due to having a too low precedence) in assignment to $valprefix and $valsuffix to circumvent having to test explicitly whether they exist
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6365 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-23 00:18:12 +00:00
Giel van Schijndel fb91a247d5 Handle C-only-fields properly when they're at the end of a struct
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6341 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 17:43:32 +00:00
Giel van Schijndel bec2172caa Allow passing of multiple strings for an enum value
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6339 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 17:25:40 +00:00
Giel van Schijndel 83b2440a3d Don't produce lines filled with only spaces (produce an empty one instead)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6336 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:20 +00:00
Giel van Schijndel 167510f3e7 * Add the option to specify custom string values for enums (which are * used when processing the database contents)
- New enum-field level qualifier: `%string "<string to use>";`
 * Use this to specify the custom strings for enum SENSOR_TYPE

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6335 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:17 +00:00
Giel van Schijndel 4e43102df3 Add the ability to retrieve the current row number by means of $rowNum
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6324 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 03:33:43 +00:00
Giel van Schijndel 47eb9bd6bc * Make sure to use "FROM" before "INNER JOIN"
* Assign the return value of sqlite3_step to "rc" not the result boolean of that return value compared with SQLITE_ROW
 * For enums allow the enumerator's name with undersquores ''and'' spaces


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6323 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 03:08:04 +00:00
Giel van Schijndel 4b0072ffb5 * Remove unused parameters
* Remove duplicated code


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6321 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 02:18:53 +00:00
Giel van Schijndel 8a8bc660ee Use string comparison for enums instead of stuffing integers in the database
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6317 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 01:20:02 +00:00
Giel van Schijndel 409eebce0e Make sure to #include <sqlite3.h> instead of "lib/sqlite3/sqlite3.h"
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6035 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-16 20:21:50 +00:00
Giel van Schijndel aad47ff640 Add a new struct level qualifier: %fetchByRow
* User code can use this to provide code that the SQLite code generator can use to get a pointer to some other struct
 * Make it so that you can only declare member fields with a `struct` type when the respective struct has a %fetchByRow directive in it
 * Generate loading code for struct-type fields in the c_sqliteload codegenerator by means of the code provided by the %fetchByRow directive


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5523 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 21:30:05 +00:00
Giel van Schijndel b464ee82a5 Don't generate SQL code (that's SQL statements for table definitions as well as SQLite loading code) for fields of type C-only-field
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5520 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 20:36:45 +00:00
Giel van Schijndel caa467d9ee * Improve error message generated on type mismatch by code generator c_sqliteload
* Fix a syntax error in code generator sql_tabledef and add and initialize the used variables to produce an error message


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5518 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 19:17:08 +00:00
Giel van Schijndel 65dee90e74 Accept all of ([US]D?WORD|[US]BYTE) as "transition" types in the mini database schema meta language
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5511 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 21:53:10 +00:00
Giel van Schijndel d8d2ad0dd6 Add a transition type "UDWORD" to the mini database schema meta language
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5501 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 15:30:32 +00:00
Giel van Schijndel 975ecbbb95 Add copies of strings declared with the "string" type in the struct definitions; thus have the structs take ownership of these strings (they're allocated with strdup)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5499 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 14:48:39 +00:00
Giel van Schijndel 87ad15af6a * Add a new struct-level directive: %suffix
- This directive adds a suffix to the names of structs (in the generated C code) and the subclasses that inherit from that struct
 * Use %suffix instead of %prefix in test_code.tpl


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5483 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 21:11:24 +00:00
Giel van Schijndel c7f60d7e7d #include "lib/sqlite3/sqlite3.h" in generated SQLite loading code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5479 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:44:14 +00:00
Giel van Schijndel c5b87954bc Add a new field type to the mini database scheme meta language: C-only-field
* This is a dummy type that causes the rest of the line to be included literally in the struct's definition
 * Use this field type to add ppIMDList (member var of BODY_STATS in statsdef.h)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5460 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 20:47:17 +00:00
Giel van Schijndel 44f3bf5f69 Only declare the function name of the %loadFunc directive to be declared in the file where the %loadFunc directive is located.
Don't declare the return type and parameter list to originate from the "original" source file.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5452 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 17:55:18 +00:00
Giel van Schijndel 2e3280a845 Pass the output file as a command line parameter (and fall back to stdout if none is provided)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5446 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 16:05:41 +00:00
Giel van Schijndel c8dbcd6d2d * Don't refer to a "flame IMD" when loading an IMD_Model, refer to "the IMD for field \"$fieldName\"" instead
* Reference records by their ID number (unique_inheritance_id) instead of some user-code dependent function

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5444 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 15:30:13 +00:00
Giel van Schijndel 03cf003811 * Add line information to the AST of %preLoadTable and %postLoadRow struct-level directives
* Use these line numbers in the output of the SQLite C loading code generator to produce #line directives

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5443 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 15:25:46 +00:00
Giel van Schijndel df7b09c6fa Wrap the "header/start/leader" template contents in #line directives for the SQLite C code generator's output
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5440 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 15:01:02 +00:00
Giel van Schijndel 3b57831282 * Add line numbers to the AST for %loadFunc directives
* Utilize these line numbers to generate #line directives in the output file


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5438 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 14:47:16 +00:00
Giel van Schijndel 2d1b9d8694 Only shift the next parameter from ARGV if there are more than one (1) left in the C SQLite code generator
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5434 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 13:49:49 +00:00
Giel van Schijndel 2b6b037ade * Rename and modify the SQL SELECT statement code generator to a code generator that produces C code for loading in the contents of database tables
* Add a template file which is used by this new code generator as a file "header"
 * Add a new struct-level directive to the mini database meta scheme language: %loadFunc which specifies that the above code generator should generate a loading function for this type plus what its name should be
 * Add a new entry for this code generator to the Makefile for testing purposes


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5432 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-09 13:04:10 +00:00