about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-17 08:39:31 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-17 08:39:31 -0800
commit59ef5da1d9161e249cd1cd8f68b021428f8523c9 (patch)
tree6477a3cfe12042fecd7c78dede26e69768a4d0c2 /src
parent18f9f4e4f447625c0a3653f5e28845e43d005e11 (diff)
downloadteliva-59ef5da1d9161e249cd1cd8f68b021428f8523c9.tar.gz
.
Diffstat (limited to 'src')
-rw-r--r--src/tlv.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/tlv.c b/src/tlv.c
index 7c73fde..33a47e1 100644
--- a/src/tlv.c
+++ b/src/tlv.c
@@ -24,7 +24,6 @@ static void teliva_load_multiline_string(lua_State* L, FILE* in, char* line, int
   while (1) {
     if (feof(in)) break;
     char c = fgetc(in);
-//?     printf("^%d$\n", (int)c);
     ungetc(c, in);
     if (c != ' ') {
       /* new definition; signal end to caller without reading a new line */
@@ -33,7 +32,6 @@ static void teliva_load_multiline_string(lua_State* L, FILE* in, char* line, int
     }
     memset(line, '\0', capacity);
     if (fgets(line, capacity, in) == NULL) break;  /* eof */
-//?     printf("ml: %s", line);
     int max = strlen(line);
     assert(line[max-1] == '\n');
     int indent = 0;
@@ -53,7 +51,6 @@ static void teliva_load_multiline_string(lua_State* L, FILE* in, char* line, int
 
 /* leave a single table on stack containing the next top-level definition from the file */
 static void teliva_load_definition(lua_State* L, FILE* in) {
-//?   printf("== new definition\n");
   lua_newtable(L);
   int def_idx = lua_gettop(L);
   char line[1024] = {'\0'};
@@ -67,7 +64,6 @@ static void teliva_load_definition(lua_State* L, FILE* in) {
   do {
     assert(line[0] == '-' || line[0] == ' ');
     assert(line[1] == ' ');
-//?     printf("l: %s", line);
     /* key/value pair always indented at 0, never empty, unambiguously not a multiline string */
     char key[512] = {'\0'};
     char value[1024] = {'\0'};
@@ -81,9 +77,7 @@ static void teliva_load_definition(lua_State* L, FILE* in) {
     assert(key[strlen(key)-1] == ':');
     key[strlen(key)-1] = '\0';
     lua_pushstring(L, key);
-//?     printf("value: %s$\n", value);
     if (value[0] != '\0') {
-//?       printf("single-line\n");
       lua_pushstring(L, value);  /* value string on same line */
       char c = fgetc(in);
       ungetc(c, in);
@@ -92,18 +86,12 @@ static void teliva_load_definition(lua_State* L, FILE* in) {
       }
       else {
         memset(line, '\0', 1024);
-//?         printf("%d\n", feof(in));
         fgets(line, 1024, in);
-//?         printf("new line: %s", line);
       }
     }
     else {
-//?       printf("multi-line\n");
       teliva_load_multiline_string(L, in, line, 1024);  /* load from later lines */
-//?       printf("new line: %s", line);
     }
-//?     printf("adding key: %s$\n", lua_tostring(L, -2));
-//?     printf("adding value: %s$\n", lua_tostring(L, -1));
     lua_settable(L, def_idx);
   } while (line[0] == ' ');
 }
@@ -137,7 +125,6 @@ static void emit_multiline_string(FILE* out, const char* value) {
 }
 
 void save_tlv(lua_State* L, char* filename) {
-//?   printf("SAVE\n");
   lua_getglobal(L, "teliva_program");
   int history_array = lua_gettop(L);
   int history_array_size = luaL_getn(L, history_array);