10 #include "EXISerializer.h"
11 #include "stringManipulate.h"
12 #include "grammarGenerator.h"
15 #define BUFFER_SIZE 30000000 // 30 MB
21 #define EXIP_STRING(str) {(char*)str, sizeof(str)-1}
33 void _error(
int lineno,
const char *msg) {
34 fprintf(stderr,
"Error: %s. Line number: %d.\n", msg, lineno);
38 void _error2(
int lineno,
const char *msg,
int code) {
39 fprintf(stderr,
"Error: %s. Code: %d. Line number: %d.\n", msg, code, lineno);
43 #define error(msg) _error(__LINE__, msg)
44 #define error2(msg, code) _error2(__LINE__, msg, code)
47 int main(
int argc,
char *argv[]) {
48 printf(
"%s starting\n", argv[0]);
54 for (i=1; i <= 100; i++) {
56 int n = pow(i*20, 1.6);
58 printf(
"data%05d.exi, %d entries\n", i, n);
61 sprintf(txt,
"data%05d.exi", i);
62 FILE *fd = fopen(txt,
"wb");
64 error(
"creating file");
92 error2(
"initializing EXI output stream", err);
107 for (j=1; j <= n; j++) {
117 sprintf(txt,
"%d", j);
128 int x = (rand()%1000)+1;
129 int y = (rand()%1000)+1;
134 sprintf(txt,
"%d", x);
141 sprintf(txt,
"%d", y);
156 error2(
"EXI serializer", err);
164 printf(
"All done.\n");
172 FILE *outfile = (FILE*) stream;
173 return fwrite(buf, 1, readSize, outfile);