diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2012-01-23 16:34:02 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2012-01-23 16:34:02 +0000 |
| commit | 4f289698f08e8b498413973f643a4b9604e168ce (patch) | |
| tree | 32e01a80922781198369e390862478a1d0e33c88 /src/runtime | |
| parent | 1af48d34ec96a00badea5c9da93a0063253854e1 (diff) | |
libpgf: forgot to add utils/pgf-print.c
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/c/utils/pgf-print.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/runtime/c/utils/pgf-print.c b/src/runtime/c/utils/pgf-print.c new file mode 100644 index 000000000..dd5789020 --- /dev/null +++ b/src/runtime/c/utils/pgf-print.c @@ -0,0 +1,29 @@ +#include <pgf/pgf.h> +#include <pgf/data.h> + +#include <gu/dump.h> +#include <gu/file.h> +#include <gu/utf8.h> + +GU_DECLARE_TYPE(PgfAbstr, struct); + +int main(void) { + GuPool* pool = gu_new_pool(); + GuExn* err = gu_exn(NULL, type, pool); + GuIn* in = gu_file_in(stdin, pool); + PgfPGF* pgf = pgf_read(in, pool, err); + int status = 0; + if (!gu_ok(err)) { + fprintf(stderr, "Reading PGF failed\n"); + status = 1; + goto fail_read; + } + GuOut* out = gu_file_out(stdout, pool); + GuWriter* wtr = gu_new_utf8_writer(out, pool); + pgf_print(pgf, wtr, err); + gu_writer_flush(wtr, err); +fail_read: + gu_pool_free(pool); + return status; +} + |
