mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 17:52:51 -06:00
started an official API to the C runtime
This commit is contained in:
@@ -5,13 +5,24 @@
|
||||
#include <gu/file.h>
|
||||
#include <gu/utf8.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
GU_DECLARE_TYPE(PgfAbstr, struct);
|
||||
|
||||
int main(void) {
|
||||
int main(int argc, char* argv[]) {
|
||||
// Set the character locale, so we can produce proper output.
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
if (argc != 1) {
|
||||
fprintf(stderr, "usage: %s pgf\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
char* filename = argv[1];
|
||||
|
||||
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);
|
||||
PgfPGF* pgf = pgf_read(filename, pool, err);
|
||||
int status = 0;
|
||||
if (!gu_ok(err)) {
|
||||
fprintf(stderr, "Reading PGF failed\n");
|
||||
|
||||
Reference in New Issue
Block a user