added viewer to main program - display dummy text for testing
[smdp.git] / tmp.c
diff --git a/tmp.c b/tmp.c
index 33b8603..a806ff4 100644 (file)
--- a/tmp.c
+++ b/tmp.c
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include "include/parser.h"
+#include "include/viewer.h"
 
 void usage() {
     fprintf(stderr, "Usage: tmp [OPTION]... [FILE]\n");
@@ -58,49 +59,18 @@ int main(int argc, char *argv[]) {
         input = stdin;
     }
 
-    // load document object from input
-    document_t *doc;
-    doc = markdown_load(input);
+    // load deck object from input
+    deck_t *deck;
+    deck = markdown_load(input);
+
+    //TODO close file
 
     if(debug > 0) {
-        // print header to STDERR
-        int offset;
-        line_t *header;
-        if(doc->header) {
-            header = doc->header;
-            while(header &&
-                header->length > 0 &&
-                header->text->text[0] == '%') {
+        markdown_debug(deck, debug);
+    }
 
-                offset = next_blank(header->text, 0) + 1;
-                fprintf(stderr, "header: %s\n", &header->text->text[offset]);
-                header = header->next;
-            }
-        }
+    ncurses_display(deck, 0, 0);
 
-        // print page/line count to STDERR
-        int cp = 0, cl = 0;
-        page_t *page = doc->page;
-        line_t *line;
-        while(page) {
-            cp++;
-            if(debug > 1) {
-                fprintf(stderr, "page %i:\n", cp);
-            }
-            line = page->line;
-            cl = 0;
-            while(line) {
-                cl++;
-                if(debug > 1) {
-                    fprintf(stderr, "  line %i: bits = %i, length = %i\n", cl, line->bits, line->length);
-                }
-                line = line->next;
-            }
-            if(debug == 1) {
-                fprintf(stderr, "page %i: %i lines\n", cp, cl);
-            }
-            page = page->next;
-        }
-    }
+    return(EXIT_SUCCESS);
 }