throw away the long obsolete runtime type information in the C runtime

This commit is contained in:
kr.angelov
2014-10-09 13:44:26 +00:00
parent 8e3ed825a8
commit 86e9acc7a7
45 changed files with 205 additions and 1270 deletions

View File

@@ -36,7 +36,7 @@ int main(int argc, char* argv[]) {
}
// Create an exception frame that catches all errors.
GuExn* err = gu_new_exn(NULL, gu_kind(type), pool);
GuExn* err = gu_new_exn(pool);
clock_t start = clock();
@@ -109,7 +109,7 @@ int main(int argc, char* argv[]) {
clock_t start = clock();
GuExn* parse_err = gu_new_exn(NULL, gu_kind(type), ppool);
GuExn* parse_err = gu_new_exn(ppool);
GuEnum* result = pgf_parse_with_heuristics(concr, cat, line, heuristics, parse_err, ppool, ppool);
PgfExprProb* ep = NULL;

View File

@@ -7,8 +7,6 @@
#include <locale.h>
#include <stdlib.h>
GU_DECLARE_TYPE(PgfAbstr, struct);
int main(int argc, char* argv[]) {
// Set the character locale, so we can produce proper output.
setlocale(LC_CTYPE, "");
@@ -20,7 +18,7 @@ int main(int argc, char* argv[]) {
char* filename = argv[1];
GuPool* pool = gu_new_pool();
GuExn* err = gu_exn(NULL, type, pool);
GuExn* err = gu_exn(pool);
PgfPGF* pgf = pgf_read(filename, pool, err);
int status = 0;
if (!gu_ok(err)) {

View File

@@ -36,7 +36,7 @@ print_result(PgfExprProb* ep, PgfConcr* to_concr,
// sequence of strings.
pgf_lzr_linearize_simple(to_concr, ctree, 0, out, err, ppool);
if (gu_exn_caught(err) == gu_type(PgfLinNonExist)) {
if (gu_exn_caught(err, PgfLinNonExist)) {
// encountered nonExist. Unfortunately there
// might be some output printed already. The
// right solution should be to use GuStringBuf.
@@ -66,7 +66,7 @@ int main(int argc, char* argv[]) {
GuString to_lang = argv[4];
// Create an exception frame that catches all errors.
GuExn* err = gu_new_exn(NULL, gu_kind(type), pool);
GuExn* err = gu_new_exn(pool);
// Read the PGF grammar.
PgfPGF* pgf = pgf_read(filename, pool, err);
@@ -152,15 +152,15 @@ int main(int argc, char* argv[]) {
clock_t start = clock();
GuExn* parse_err = gu_new_exn(NULL, gu_kind(type), ppool);
GuExn* parse_err = gu_new_exn(ppool);
result =
pgf_parse(from_concr, cat, line, parse_err, ppool, ppool);
if (!gu_ok(parse_err)) {
if (gu_exn_caught(parse_err) == gu_type(PgfExn)) {
if (gu_exn_caught(parse_err, PgfExn)) {
GuString msg = gu_exn_caught_data(parse_err);
gu_string_write(msg, out, err);
gu_putc('\n', out, err);
} else if (gu_exn_caught(parse_err) == gu_type(PgfParseError)) {
} else if (gu_exn_caught(parse_err, PgfParseError)) {
gu_puts("Unexpected token: \"", out, err);
GuString tok = gu_exn_caught_data(parse_err);
gu_string_write(tok, out, err);