summaryrefslogtreecommitdiff
path: root/src/runtime/c/utils/pgf-parse.c
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-05 11:20:39 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-05 11:20:39 +0000
commit7c0bad50921365746ea362710015853a4879c0a7 (patch)
treeead13c32a5b2d8ed2968bcdc5b58e5e7eed79720 /src/runtime/c/utils/pgf-parse.c
parent504341dfbafdcd858704350162bb7e233cf6daf2 (diff)
remove the read and write modules from libgu. this simplifies the i/o layer
Diffstat (limited to 'src/runtime/c/utils/pgf-parse.c')
-rw-r--r--src/runtime/c/utils/pgf-parse.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/runtime/c/utils/pgf-parse.c b/src/runtime/c/utils/pgf-parse.c
index c64b07434..a990ee933 100644
--- a/src/runtime/c/utils/pgf-parse.c
+++ b/src/runtime/c/utils/pgf-parse.c
@@ -1,6 +1,5 @@
#include <gu/variant.h>
#include <gu/map.h>
-#include <gu/dump.h>
#include <gu/log.h>
#include <gu/enum.h>
#include <gu/file.h>
@@ -75,11 +74,6 @@ int main(int argc, char* argv[]) {
// Create an output stream for stdout
GuOut* out = gu_file_out(stdout, pool);
- // Locale-encoding writers are currently unsupported
- // GuWriter* wtr = gu_locale_writer(out, pool);
- // Use a writer with hard-coded utf-8 encoding for now.
- GuWriter* wtr = gu_new_utf8_writer(out, pool);
-
// We will keep the latest results in the 'ppool' and
// we will iterate over them by using 'result'.
GuPool* ppool = NULL;
@@ -118,8 +112,8 @@ int main(int argc, char* argv[]) {
clock_t start = clock();
- GuReader *rdr = gu_string_reader(gu_str_string(line, ppool), ppool);
- PgfLexer *lexer = pgf_new_simple_lexer(rdr, ppool);
+ GuIn *in = gu_string_in(gu_str_string(line, ppool), ppool);
+ PgfLexer *lexer = pgf_new_simple_lexer(in, ppool);
GuEnum* result = pgf_parse_with_heuristics(concr, cat, lexer, heuristics, ppool, ppool);
PgfExprProb* ep = NULL;
@@ -129,15 +123,15 @@ int main(int argc, char* argv[]) {
clock_t end = clock();
double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
- gu_printf(wtr, err, "%d (%.0f ms): ", ctr, 1000.0 * cpu_time_used);
+ gu_printf(out, err, "%d (%.0f ms): ", ctr, 1000.0 * cpu_time_used);
if (ep != NULL) {
- gu_printf(wtr, err, "[%.4f] (", ep->prob);
- pgf_print_expr(ep->expr, NULL, 0, wtr, err);
- gu_printf(wtr, err, ")\n");
+ gu_printf(out, err, "[%.4f] (", ep->prob);
+ pgf_print_expr(ep->expr, NULL, 0, out, err);
+ gu_printf(out, err, ")\n");
} else {
- gu_printf(wtr, err, "---\n");
+ gu_printf(out, err, "---\n");
}
- gu_writer_flush(wtr, err);
+ gu_out_flush(out, err);
}
fail: