diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-10-04 00:05:46 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-10-04 00:05:46 +0200 |
commit | 6d5a32fc3bf707bafc19e239dd60371bece90fd1 (patch) | |
tree | e5f726f52a45078fb94aa9941240e9b4fe2d3227 /src/parse.c | |
parent | Remove debug prints.. (diff) | |
download | calp-6d5a32fc3bf707bafc19e239dd60371bece90fd1.tar.gz calp-6d5a32fc3bf707bafc19e239dd60371bece90fd1.tar.xz |
General cleanup in parse.
Diffstat (limited to '')
-rw-r--r-- | src/parse.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/parse.c b/src/parse.c index 996c0a92..fbfb2387 100644 --- a/src/parse.c +++ b/src/parse.c @@ -73,6 +73,9 @@ int parse_file(char* filename, FILE* f, SCM root) { SCM attr_key; /* string */ SCM line_key = scm_from_utf8_string(""); /* string */ + SCM scm_filename = scm_from_utf8_stringn(filename, strlen(filename)); + SCM filename_key = scm_from_utf8_string("X-HNH-FILENAME"); + char c; while ( (c = fgetc(f)) != EOF) { /* We have a linebreak */ @@ -91,15 +94,11 @@ int parse_file(char* filename, FILE* f, SCM root) { /* TODO it should be possible to create this object once at the top of this function */ - SCM templine = - scm_make_vline(scm_from_utf8_stringn(filename, strlen(filename))); - scm_add_line_x(child, scm_from_utf8_string("X-HNH-FILENAME"), - templine); + scm_add_line_x(child, filename_key, scm_make_vline(scm_filename)); component = child; } else if (string_eq(line_key, scm_from_utf8_string("END"))) { - // TODO make current component be parent of current component? component = scm_component_parent(component); /* @@ -153,12 +152,6 @@ int parse_file(char* filename, FILE* f, SCM root) { * parameters. */ if (p_ctx == p_key) { - - // TRANSFER(&cline_key, &ctx.str); - - // NEW(content_set, p); - // PUSH(LLIST(content_set))(&cline, p); - // attr_key line_key = scm_from_strbuf(&str); strbuf_soft_reset (&str); } |