diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c index 2182972..7cf5f75 100644 --- a/hmml_to_html/hmml_to_html.c +++ b/hmml_to_html/hmml_to_html.c @@ -1,6 +1,6 @@ #if 0 ctime -begin ${0%.*}.ctm -gcc -g -fsanitize=address $0 -o ${0%.*} hmml.a +gcc -g -Wall -Wno-unused-variable -fsanitize=address $0 -o ${0%.*} hmml.a ctime -end ${0%.*}.ctm exit #endif @@ -111,6 +111,7 @@ CopyStringToBuffer(char *Src, buffer *Dest) { *Dest->Ptr++ = *Src++; } + *Dest->Ptr = '\0'; } int @@ -178,6 +179,252 @@ main(int ArgC, char **Args) int ClaimedMemory = 0; // NOTE(matt): Setup buffers and ptrs +#if 1 + char *InPtr; + + buffer Title; + buffer QuoteMenu; + buffer ReferenceMenu; + + buffer Player; + buffer Annotation; + buffer AnnotationHeader; + buffer AnnotationClass; + buffer AnnotationData; + buffer Text; + buffer Category; + + buffer Master; + + for(int FileIndex = 1; FileIndex < ArgC; ++FileIndex) + { + FILE *InFile; + if(!(InFile = fopen(Args[FileIndex], "r"))) + { + perror(Args[0]); + free(MemoryArena); + return 1; + } + + HMML_Output HMML = hmml_parse_file(InFile); + fclose(InFile); + + if(HMML.well_formed) + { + int PrintLength; + + ClaimBuffer(MemoryArena, &ClaimedMemory, &Title, 1024 * 16); + ClaimBuffer(MemoryArena, &ClaimedMemory, &Player, 1024 * 256); + + PrintLength = sprintf(Title.Ptr, +"