diff --git a/main.c b/main.c index 1379fa7..0e38d45 100644 --- a/main.c +++ b/main.c @@ -12,14 +12,6 @@ char* getoutname(char* fname, int fnamelen) { return outf; } -void printlns(LINELIST* lns, FILE* stream) { - LINELIST* curln = lns; - while(curln != NULL) { - fprintf(stream, "%s\n", curln->content); - curln = curln->next; - } -} - int main(int argc, char* argv[]) { if(argc < 2) { printf("Usage: %s {input}\n", argv[0]); diff --git a/parser.c b/parser.c index 9277d7c..b718dfa 100644 --- a/parser.c +++ b/parser.c @@ -4,6 +4,7 @@ #include #include #include "parser.h" +#include "util.h" void pushln(LINELIST** curln, char* tmpln, int lnind, int truen) { int size = (lnind+1)*sizeof(char); diff --git a/parser.h b/parser.h index 3919cf0..d7d8a9a 100644 --- a/parser.h +++ b/parser.h @@ -1,14 +1,11 @@ #ifndef PARSER_H #define PARSER_H + #include +#include "util.h" #define INST_LIMIT 1<<15 -typedef struct lnls { - char* content; - int truen; - struct lnls* next; -} LINELIST; typedef struct { FILE* input; diff --git a/util.c b/util.c index 5186e56..d5e34c3 100644 --- a/util.c +++ b/util.c @@ -22,3 +22,11 @@ int countplaces(int n) { } return places; } + +void printlns(LINELIST* lns, FILE* stream) { + LINELIST* curln = lns; + while(curln != NULL) { + fprintf(stream, "%s\n", curln->content); + curln = curln->next; + } +} diff --git a/util.h b/util.h index f6fde00..5a9daa1 100644 --- a/util.h +++ b/util.h @@ -1,5 +1,16 @@ #ifndef UTIL_H #define UTIL_H + +#include + char* heapstr(const char* str, int len); int countplaces(int n); + +typedef struct lnls { + char* content; + int truen; + struct lnls* next; +} LINELIST; + +void printlns(LINELIST* lns, FILE* stream); #endif