Commit ccbebab6 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Get DBT to work

git-svn-id: file:///svn/tokudb@251 c7de825b-a66e-492c-adef-691d508d4ae1
parent 529ca328
...@@ -25,15 +25,14 @@ struct fieldinfo { ...@@ -25,15 +25,14 @@ struct fieldinfo {
#include "sample_offsets_32.h" #include "sample_offsets_32.h"
#include "sample_offsets_64.h" #include "sample_offsets_64.h"
void print_db_struct (void) { void print_struct (const char *structname, struct fieldinfo *fields32, struct fieldinfo *fields64, unsigned int N) {
unsigned int i; unsigned int i;
unsigned int current_32 = 0; unsigned int current_32 = 0;
unsigned int current_64 = 0; unsigned int current_64 = 0;
int dummy_counter=0; int dummy_counter=0;
// int did_toku_internal=0; // int did_toku_internal=0;
printf("struct __toku_db {\n"); printf("struct __toku_%s {\n", structname);
assert(sizeof(fields32)==sizeof(fields64)); for (i=0; i<N; i++) {
for (i=0; i<sizeof(fields32)/sizeof(fields32[0]); i++) {
unsigned int this_32 = fields32[i].off; unsigned int this_32 = fields32[i].off;
unsigned int this_64 = fields64[i].off; unsigned int this_64 = fields64[i].off;
assert(strcmp(fields32[i].decl, fields64[i].decl)==0); assert(strcmp(fields32[i].decl, fields64[i].decl)==0);
...@@ -79,7 +78,13 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un ...@@ -79,7 +78,13 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
printf("#if defined(__cplusplus)\nextern \"C\" {\n#endif\n"); printf("#if defined(__cplusplus)\nextern \"C\" {\n#endif\n");
printf("typedef struct __toku_db DB;\n"); printf("typedef struct __toku_db DB;\n");
print_dbtype(); print_dbtype();
print_db_struct();
assert(sizeof(db_fields32)==sizeof(db_fields64));
print_struct("db", db_fields32, db_fields64, sizeof(db_fields32)/sizeof(db_fields32[0]));
assert(sizeof(dbt_fields32)==sizeof(dbt_fields64));
print_struct("dbt", dbt_fields32, dbt_fields64, sizeof(dbt_fields32)/sizeof(dbt_fields32[0]));
printf("#if defined(__cplusplus)\n}\n#endif\n"); printf("#if defined(__cplusplus)\n}\n#endif\n");
printf("#endif\n"); printf("#endif\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment