From 08788af6d50bf3f8a6b69b88a144597c3a997e8b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 19 May 2023 23:33:34 +0300 Subject: document main --- src/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 9077061..3faf5d5 100644 --- a/src/main.c +++ b/src/main.c @@ -16,9 +16,14 @@ #include #include +/** + * String describing compiler usage. + * @todo I suspect backends might want more flags, come up with + * some way to make flag handling more generic + */ static const char *cmdline_usage = "ek compiler usage:\n" - " cu [-I ...] [-D ...] infile...\n" + " ek [-I ...] [-D ...] infile...\n" " -h Show usage (this)\n" " -I Add directory to import path\n" " -D Add predefined variable\n" @@ -26,11 +31,22 @@ static const char *cmdline_usage = " infile Top file(s) to compile\n" ; +/** Print usage of compiler. */ static void usage() { fprintf(stderr, cmdline_usage); } +/** + * Main entry to compiler. + * Checks command line parameters and drives the rest of the compiler. + * Feels kind of weird documenting main, but doxygen warns about not + * doing it so whatever. + * + * @param argc Number of command line arguments. + * @param argv Array of command line arguments. + * @return \c 0 when succesful, non-zero otherwise. + */ int main(int argc, char *argv[]) { int opt; -- cgit v1.3