Browse files

Generate all declarations first to aid older compilers (bug 8).

  • Loading branch information...
1 parent 31e3c6f commit d9e745ffe78727be258d5670e199c67863c22fdb @josb committed Mar 8, 2011
Showing with 34 additions and 30 deletions.
  1. +30 −30 ext/amalgalite/amalgalite3_constants.c
  2. +4 −0 ext/amalgalite/gen_constants.rb
View
60 ext/amalgalite/amalgalite3_constants.c
@@ -21,6 +21,36 @@ void Init_amalgalite3_constants( )
*/
VALUE mC_Config = rb_define_module_under(mC, "Config");
+ /**
+ * module encapsulating the SQLite3 C extension constants for DBStatus
+ */
+ VALUE mC_DBStatus = rb_define_module_under(mC, "DBStatus");
+
+ /**
+ * module encapsulating the SQLite3 C extension constants for DataType
+ */
+ VALUE mC_DataType = rb_define_module_under(mC, "DataType");
+
+ /**
+ * module encapsulating the SQLite3 C extension constants for Open
+ */
+ VALUE mC_Open = rb_define_module_under(mC, "Open");
+
+ /**
+ * module encapsulating the SQLite3 C extension constants for ResultCode
+ */
+ VALUE mC_ResultCode = rb_define_module_under(mC, "ResultCode");
+
+ /**
+ * module encapsulating the SQLite3 C extension constants for StatementStatus
+ */
+ VALUE mC_StatementStatus = rb_define_module_under(mC, "StatementStatus");
+
+ /**
+ * module encapsulating the SQLite3 C extension constants for Status
+ */
+ VALUE mC_Status = rb_define_module_under(mC, "Status");
+
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_Config, "GETMALLOC", INT2FIX(SQLITE_CONFIG_GETMALLOC));
@@ -66,11 +96,6 @@ void Init_amalgalite3_constants( )
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_Config, "SINGLETHREAD", INT2FIX(SQLITE_CONFIG_SINGLETHREAD));
- /**
- * module encapsulating the SQLite3 C extension constants for DBStatus
- */
- VALUE mC_DBStatus = rb_define_module_under(mC, "DBStatus");
-
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_DBStatus, "CACHE_USED", INT2FIX(SQLITE_DBSTATUS_CACHE_USED));
@@ -86,11 +111,6 @@ void Init_amalgalite3_constants( )
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_DBStatus, "STMT_USED", INT2FIX(SQLITE_DBSTATUS_STMT_USED));
- /**
- * module encapsulating the SQLite3 C extension constants for DataType
- */
- VALUE mC_DataType = rb_define_module_under(mC, "DataType");
-
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_DataType, "BLOB", INT2FIX(SQLITE_BLOB));
@@ -106,11 +126,6 @@ void Init_amalgalite3_constants( )
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_DataType, "TEXT", INT2FIX(SQLITE_TEXT));
- /**
- * module encapsulating the SQLite3 C extension constants for Open
- */
- VALUE mC_Open = rb_define_module_under(mC, "Open");
-
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
@@ -165,11 +180,6 @@ void Init_amalgalite3_constants( )
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_Open, "WAL", INT2FIX(SQLITE_OPEN_WAL));
- /**
- * module encapsulating the SQLite3 C extension constants for ResultCode
- */
- VALUE mC_ResultCode = rb_define_module_under(mC, "ResultCode");
-
/* 4 -- Callback routine requested an abort */
rb_define_const(mC_ResultCode, "ABORT", INT2FIX(SQLITE_ABORT));
@@ -326,11 +336,6 @@ void Init_amalgalite3_constants( )
/* 18 -- String or BLOB exceeds size limit */
rb_define_const(mC_ResultCode, "TOOBIG", INT2FIX(SQLITE_TOOBIG));
- /**
- * module encapsulating the SQLite3 C extension constants for StatementStatus
- */
- VALUE mC_StatementStatus = rb_define_module_under(mC, "StatementStatus");
-
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_StatementStatus, "AUTOINDEX", INT2FIX(SQLITE_STMTSTATUS_AUTOINDEX));
@@ -340,11 +345,6 @@ void Init_amalgalite3_constants( )
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_StatementStatus, "SORT", INT2FIX(SQLITE_STMTSTATUS_SORT));
- /**
- * module encapsulating the SQLite3 C extension constants for Status
- */
- VALUE mC_Status = rb_define_module_under(mC, "Status");
-
/* no meaningful autogenerated documentation -- constant is self explanatory ?*/
rb_define_const(mC_Status, "MALLOC_COUNT", INT2FIX(SQLITE_STATUS_MALLOC_COUNT));
View
4 ext/amalgalite/gen_constants.rb
@@ -174,6 +174,10 @@
f.puts " */"
f.puts " VALUE mC_#{klass} = rb_define_module_under(mC, \"#{klass}\");"
f.puts
+ end
+
+ CONSTANTS.keys.sort.each do |klass|
+ const_set = CONSTANTS[klass]
const_set.keys.sort.each do |k|
sql_const = const_set[k]
const_doc = " /* no meaningful autogenerated documentation -- constant is self explanatory ?*/"

0 comments on commit d9e745f

Please sign in to comment.