]> ocean-lang.org Git - ocean/blobdiff - csrc/boot-strap/md2c.c
Refresh boot-strap files.
[ocean] / csrc / boot-strap / md2c.c
index 2b18737fcfd19e8e2e3221e32b01c964065a8a0f..71e377179adb2f45c73e4f8a427add82ec425cd8 100644 (file)
@@ -1,53 +1,17 @@
-#line 119 "../mdcode.mdc"
+#line 120 "../mdcode.mdc"
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "mdcode.h"
 
-#line 849 "../mdcode.mdc"
+#line 860 "../mdcode.mdc"
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/mman.h>
 #include <string.h>
-#include <stdio.h>
-
-#line 771 "../mdcode.mdc"
-static void code_print(FILE *out, struct code_node *node,
-                      char *fname)
-{
-       for (; node; node = node->next) {
-               char *c = node->code.txt;
-               int len = node->code.len;
-               int undent = 0;
-
-               if (!len)
-                       continue;
-
-               fprintf(out, "#line %d \"%s\"\n",
-                       node->line_no, fname);
-               if (*c == ' ' || *c == '\t')
-                       undent = 1;
-               while (len && *c) {
-                       fprintf(out, "%*s", node->indent, "");
-                       if (undent) {
-                               if (*c == '\t' && len > 1) {
-                                       c++;
-                                       len--;
-                               } else if (strncmp(c, "    ", 4) == 0 && len > 4) {
-                                       c += 4;
-                                       len-= 4;
-                               }
-                       }
-                       do {
-                               fputc(*c, out);
-                               c++;
-                               len--;
-                       } while (len && c[-1] != '\n');
-               }
-       }
-}
 
-#line 821 "../mdcode.mdc"
+#line 832 "../mdcode.mdc"
 static void copy_fname(char *name, int space, struct text t)
 {
        char *sec = t.txt;
@@ -67,7 +31,7 @@ static void copy_fname(char *name, int space, struct text t)
        name[len] = 0;
 }
 
-#line 857 "../mdcode.mdc"
+#line 867 "../mdcode.mdc"
 static int errs;
 static void pr_err(char *msg)
 {
@@ -123,11 +87,11 @@ int main(int argc, char *argv[])
                        errs++;
                        continue;
                }
-               code_print(fl, s->code, argv[1]);
+               code_node_print(fl, s->code, argv[1]);
                fclose(fl);
        }
        exit(!!errs);
 }
 
-#line 126 "../mdcode.mdc"
+#line 128 "../mdcode.mdc"