From 4f289698f08e8b498413973f643a4b9604e168ce Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Mon, 23 Jan 2012 16:34:02 +0000 Subject: [PATCH] libpgf: forgot to add utils/pgf-print.c --- src/runtime/c/utils/pgf-print.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/runtime/c/utils/pgf-print.c 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 +#include + +#include +#include +#include + +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; +} +