Commit Graph

142 Commits (bb7e111e006726695064bb33e45d29d4ee0ea5f7)

Author SHA1 Message Date
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 d11d2411bd * Prevent writing to regex-capture variables, e.g. \$1
- Use a temporary variable instead


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6346 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-17 08:51:07 +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 27856b5de5 * Make sure to wrap the produced SQL INSERT statements in a TRANSACTION
* At the start of a new struct's data place the name of that struct

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6333 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:12 +00:00
Giel van Schijndel 5dc4adb8d5 Add Doxygen comments to the produced STATS_(BASE|COMPONENT) macros as well, to give Doxygen a chance to properly document structures that use these macros
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6329 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 14:08:23 +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 1835d9aa04 Add a new code generator to generate a series of INSERT statements from the CSV files to fill a database with
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6322 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 02:20:42 +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 001f2f90ea Store enums as text
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6318 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 01:41:48 +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 91dbb225df Use .schema.sql as default output extension for SQL CREATE TABLE definitions
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6314 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 00:22:10 +00:00
Giel van Schijndel d2c8fbc5a8 * Change the database meta language script parser such that it's first parameter has to be a valid relative path to the code generator to use
* Change the make rules for all files produced from the database meta language such that they have the language parser and code generator as dependency as well (i.e. if they change their files will be rebuilt)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6312 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-15 21:39:00 +00:00
Giel van Schijndel 46002d39d9 Use WZ_DECL_MAY_ALIAS for the BASE_STATS "derived" structures because we perform "type punning" on these pointers in a similar fashion to the BASE_OBJECT hierarchy.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6177 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-16 13:49:05 +00:00
Giel van Schijndel e81ac54c92 Mark removeAfterNewLine as static
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6149 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-14 12:58:53 +00:00
Giel van Schijndel 2c8a322504 * Don't manually maintain a line-count variable as Perl does this (I found out while reading the Camel book) automatically in the $. variable
* Include the filename of the currently being parsed file in error messages
 * Make sure to reset Perl's line counter ($.) when we start parsing a new file (when using <> as file handle)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6101 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-01 14:53:46 +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 c1fb0af729 * -mwindows is a linker flag, so move it from CFLAGS and CXXFLAGS to LDFLAGS
* autorevision is a command line utility, not a GUI program, so strip the -mwindows flag from its linker flags

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5646 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-23 13:48:50 +00:00
Giel van Schijndel 8344514617 Make sure to use the %prefix and %suffix when declaring pointers to structs
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5524 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 21:39:49 +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 9eb61150c0 Add a new datatype to the mini database schema meta language: `struct`
* Allows "linking" in the database to other struct instances
 * Will be represented as a pointer to the target struct in the C datastructures
 * Will be represented as an integer ID in tables


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5519 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 19:48:39 +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 2e5fab25f8 Attach line numbers to the AST of field declarations, and use it when reporting field-related errors
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5513 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 22:14:09 +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 e33f083aaf Give errors when encountering unmatched struct-level and enum-level directives
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5510 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 21:48:34 +00:00
Giel van Schijndel 7f75a8f3c7 Add a new %nomacro directive to prevent macro definition of a struct and its children if the parent of that struct has a %macro directive
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5505 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 16:41:59 +00:00
Giel van Schijndel 05bf9bdcd8 Declare UDWORDs as UDWORD in the C code (doh!) not as unsigned int...
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5502 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 15:33:48 +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 8ce0412a28 * Add new %macro, %macroprefix and %macrosuffix directives to the mini database schema meta language
* Generate macro definitions similar to our current "inheritance-like" structure as created by macros when the above %macro directive is used


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5498 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 14:02:17 +00:00
Giel van Schijndel b16526e0a9 Move the code for generating the forward declaration of the SQLite loading function to a separate function of its own: printLoadFunc
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5497 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 13:30:25 +00:00
Giel van Schijndel 4452048964 Don't use a default value for %valprefix when either %valprefix or %valsuffix has been specified
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5495 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 13:06:02 +00:00
Giel van Schijndel 51370fcdbd Add a new enum-level directive: %valsuffix which (similar to %valprefix) adds a suffix to al enum's values
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5491 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 11:17:08 +00:00
Giel van Schijndel 3ca7c41f58 Don't add %valprefix to %max
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5490 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 11:13:01 +00:00
Giel van Schijndel dc0aa99fac Allow empty value prefixes as well (using the %valprefix directive)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5486 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 22:23:19 +00:00
Giel van Schijndel b1d12b5a1a * Add a new enum-level qualifier: %valprefix; this changes the default prefix (which is just the enum's name with '_' appended) prefixed to all enum values
* Add a new enum that uses this: COMPONENT_TYPE


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5484 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 21:24: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 2a11247d7e Add a new enum-level directive: %max "param":
* This will add an enumerator to the end of the generated C enum code with "param" as its name (prefixed by the enum's name of course)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5482 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 21:02:58 +00:00
Giel van Schijndel eb7bd7be49 Update test_code.tpl as well to match r5480's change in syntax
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5481 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:52:57 +00:00
Giel van Schijndel 118a83f42a Slight change in syntax to not require (and disallow) a semi-colon after struct-level directives that open a new scope (terminated with "end\;"
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5480 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:52:09 +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 82a2aea03f c_structdef_cg.pm: Fix an error where we forgot to use the \{"name"\} member of the hash thus resulting in bad code being generated
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5478 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:43:26 +00:00
Dennis Schridde c2f5375cb2 Remove crossbuild hacks, which probably not worked like that on Windows anyway.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5477 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:17:13 +00:00
Dennis Schridde 022315eef0 Hardcode top_srcdir to make building from non-topdir possible, dont depend on the touch command, fix LDFLAGS to not depend on the removed TARGET variable
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5476 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:10:16 +00:00
Giel van Schijndel b5ff9610ea * Remove TODO comment about needing to add an IMD_Model type, because that type already exists
* Add a comment, describing the `flameModel` field


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5465 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 11:03:39 +00:00