main.cc
changeset 878 89eb85bab58f
parent 873 dea39ef02847
child 924 9e824bb0c3d4
--- a/main.cc	Sun Mar 16 10:16:25 2014 +0000
+++ b/main.cc	Sun Mar 16 13:02:28 2014 +0000
@@ -109,10 +109,10 @@
 
 
 static void printusage(const char *cmd) {
-  printf("\nsyntax: %s [-h] [-v] [-f] [-s] [-c] [-I <include_directory>] [-T <target_directory>] <input_file>\n", cmd);
-  printf("  h : show this help message\n");
-  printf("  v : print version number\n");  
-  printf("  f : display full token location on error messages\n");
+  printf("\nsyntax: %s [<options>] [-O <output_options>] [-I <include_directory>] [-T <target_directory>] <input_file>\n", cmd);
+  printf(" -h : show this help message\n");
+  printf(" -v : print version number\n");  
+  printf(" -f : display full token location on error messages\n");
       /******************************************************/
       /* whether we are supporting safe extensions          */
       /* as defined in PLCopen - Technical Committee 5      */
@@ -120,10 +120,12 @@
       /* Part 1: Concepts and Function Blocks,              */
       /* Version 1.0 is Official Release                    */
       /******************************************************/
-  printf("  s : allow use of safe extensions (e.g. SAFExxx data types))\n");
-  printf("  n : allow use of nested comments (an IEC 61131-3 v3 feature)\n");
-  printf("  r : allow use of REF() operator  (an IEC 61131-3 v3 feature)\n");
-  printf("  c : create conversion functions for enumerated data types\n");
+  printf(" -s : allow use of safe extensions (e.g. SAFExxx data types))\n");
+  printf(" -n : allow use of nested comments (an IEC 61131-3 v3 feature)\n");
+  printf(" -r : allow use of REF() operator  (an IEC 61131-3 v3 feature)\n");
+  printf(" -c : create conversion functions for enumerated data types\n");
+  printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
+  stage4_print_options();
   printf("\n");
   printf("%s - Copyright (C) 2003-2014 \n"
          "This program comes with ABSOLUTELY NO WARRANTY!\n"
@@ -150,15 +152,14 @@
   /******************************************/
   /*   Parse command line options...        */
   /******************************************/
-  while ((optres = getopt(argc, argv, ":nhvfrscI:T:")) != -1) {
+  while ((optres = getopt(argc, argv, ":nhvfrscI:T:O:")) != -1) {
     switch(optres) {
     case 'h':
       printusage(argv[0]);
       return 0;
 
     case 'v':
-      fprintf(stdout, "%s version %s\n"
-		      "changeset id: %s\n", PACKAGE_NAME, PACKAGE_VERSION, HGVERSION);      
+      fprintf(stdout, "%s version %s\n" "changeset id: %s\n", PACKAGE_NAME, PACKAGE_VERSION, HGVERSION);      
       return 0;
 
     case 'f':
@@ -199,7 +200,11 @@
       builddir = optarg;
       break;
 
-    case ':':       /* -I or -T without operand */
+    case 'O':
+      if (stage4_parse_options(optarg) < 0) errflg++;
+      break;
+
+    case ':':       /* -I, -T, or -O without operand */
       fprintf(stderr, "Option -%c requires an operand\n", optopt);
       errflg++;
       break;