diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-09-27 02:15:04 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-09-27 02:15:04 +0200 |
commit | 6ddde92a3a45e970b05770633dc6a337d5d013c5 (patch) | |
tree | 1dec4612d7469839478e72d16d30a0da5755243c /tests/t-parse.c | |
download | mupdf-6ddde92a3a45e970b05770633dc6a337d5d013c5.tar.xz |
Initial import
Diffstat (limited to 'tests/t-parse.c')
-rw-r--r-- | tests/t-parse.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/t-parse.c b/tests/t-parse.c new file mode 100644 index 00000000..fabd2060 --- /dev/null +++ b/tests/t-parse.c @@ -0,0 +1,44 @@ +#include <fitz.h> + +int +main(int argc, char **argv) +{ + fz_error *err; + fz_obj *obj; + int i; + + if (argc == 1) + { + err = fz_packobj(&obj, + "[ %s %r [ %i ] " + "<< /Float %f /BinString %# /Name %n /Int %i >> " + "(foo) /bar 3223 [ [ 1 2 3 %i ] %i [ 23 ] %i ]", + "Hello, world", + 3, 0, + 42, + 23.5, + "f\0obar", 4, + "Foo", + 666, + -1, -2 , -3 + ); + if (err) fz_abort(err); + + printf("pretty: "); fz_fprintobj(stdout, obj); printf("\n"); + printf("comapct: "); fz_fprintcobj(stdout, obj); printf("\n"); + fz_dropobj(obj); + printf("\n"); + } + + for (i = 1; i < argc; i++) { + err = fz_parseobj(&obj, argv[i]); + if (err) fz_abort(err); + printf("pretty: "); fz_fprintobj(stdout, obj); printf("\n"); + printf("compact: "); fz_fprintcobj(stdout, obj); printf("\n"); + fz_dropobj(obj); + printf("\n"); + } + + return 0; +} + |