|
@@ -667,23 +667,12 @@ void markup_to_program(String_View content, FILE *stream, char *begin, char *end
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void program_to_markup(String_View content, FILE *stream, char *begin, char *end, char *comment)
|
|
|
|
-{
|
|
|
|
- (void) content;
|
|
|
|
- (void) stream;
|
|
|
|
- (void) begin;
|
|
|
|
- (void) end;
|
|
|
|
- (void) comment;
|
|
|
|
- assert(0 && "TODO: program_to_markup not implemented");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int main(int argc, char **argv)
|
|
int main(int argc, char **argv)
|
|
{
|
|
{
|
|
bool *help = flag_bool("help", false, "Print this help to stdout and exit with 0.");
|
|
bool *help = flag_bool("help", false, "Print this help to stdout and exit with 0.");
|
|
char **begin = flag_str("begin", "\\begin{code}", "Line that denotes the beginning of the code block in the markup language.");
|
|
char **begin = flag_str("begin", "\\begin{code}", "Line that denotes the beginning of the code block in the markup language.");
|
|
char **end = flag_str("end", "\\end{code}", "Line that denotes the end of the code block in the markup language.");
|
|
char **end = flag_str("end", "\\end{code}", "Line that denotes the end of the code block in the markup language.");
|
|
char **comment = flag_str("comment", "//", "The inline comment of the programming language.");
|
|
char **comment = flag_str("comment", "//", "The inline comment of the programming language.");
|
|
- char **mode = flag_str("mode", "m2p", "Conversion mode. m2p -- markup to program. p2m -- program to markup.");
|
|
|
|
|
|
|
|
if (!flag_parse(argc, argv)) {
|
|
if (!flag_parse(argc, argv)) {
|
|
usage(stderr);
|
|
usage(stderr);
|
|
@@ -724,15 +713,7 @@ int main(int argc, char **argv)
|
|
// TODO: output directly to a file without the need to redirect anything
|
|
// TODO: output directly to a file without the need to redirect anything
|
|
|
|
|
|
String_View content = sv_from_parts(mf.content_data, mf.content_size);
|
|
String_View content = sv_from_parts(mf.content_data, mf.content_size);
|
|
- if (strcmp(*mode, "m2p") == 0) {
|
|
|
|
- markup_to_program(content, stdout, *begin, *end, *comment);
|
|
|
|
- } else if (strcmp(*mode, "p2m") == 0) {
|
|
|
|
- program_to_markup(content, stdout, *begin, *end, *comment);
|
|
|
|
- } else {
|
|
|
|
- usage(stderr);
|
|
|
|
- fprintf(stderr, "ERROR: unknown mode %s\n", *mode);
|
|
|
|
- exit(1);
|
|
|
|
- }
|
|
|
|
|
|
+ markup_to_program(content, stdout, *begin, *end, *comment);
|
|
|
|
|
|
mf_unmap(&mf);
|
|
mf_unmap(&mf);
|
|
|
|
|