Improved help messages in command line. Started code to select supported standards
authorEbersold <aebersol@n3150.home>
Mon, 16 May 2022 20:59:50 +0000 (22:59 +0200)
committerEbersold <aebersol@n3150.home>
Mon, 16 May 2022 20:59:50 +0000 (22:59 +0200)
libparser/asn1.y
libparser/asn1_parser.h
main.cpp

index 0543511a943430d9a5991f3d0dfc001229cee7d6..5d0550996f824099c75ae699d3b4814574f4f9b9 100644 (file)
@@ -2208,7 +2208,7 @@ builtin_type: boolean_def
              | enumerated_def  {$$ = $1;}\r
              | bit_string_def {$$ = $1;} \r
              | real_def {$$ = $1;}\r
-             | time_def { $$ = $1;}\r
+             | time_def { $$ = $1;} /* TODO this is UsefulType and must be in referenced_type rule */\r
              | octet_string_def {$$ =$1;}\r
              | object_def {$$ = $1;}\r
              | object_class_def {$$ = $1;}\r
@@ -2611,7 +2611,7 @@ value: builtin_value {
   /* ReferencedValue */\r
   | defined_value\r
   {\r
-    ASN_LOG_DEBUG("value: defined_value   ..");\r
+    ASN_LOG_DEBUG("value: defined_value : %s",$<node>1->name().c_str());\r
     $$->meta_id(asn1::meta::VALUE);\r
     asn1::value *v = new asn1::value($1->name());\r
     $$->value(v);\r
@@ -2806,9 +2806,9 @@ constant_set_def:
 ;\r
 \r
 \r
-defined_type:  /* * More complex types */ \r
+defined_type:  /* * More complex types itu X.683 parameterized type */ \r
   complex_type_reference T_LBRACET {\r
-      ASN_LOG_DEBUG("defined_type: 1 %s start (params:...)",$1->name().c_str());\r
+      ASN_LOG_DEBUG("defined_type: 1 %s start {params:...}",$1->name().c_str());\r
       asn1::parser *p = asn1::parser::instance();\r
       asn1::module *m= (asn1::module *) p->module();\r
       m->enter_context(new asn1::act_parameters());\r
index 6546f2a9affdfd9f44407824628e7d84cfbbf800..8920c615dabcb054da906d57583ede776364d311 100644 (file)
@@ -18,6 +18,13 @@ class parser
     typedef std::list<asn1::parser_listener *> listener_list;
     
     typedef std::list<std::string>        string_list;
+    /* Bit field value for supported standards */
+    enum Standards {
+      X_680   = 1
+      , X_681 = 2
+      , X_682 = 4
+      , X_683 = 8
+    };
 
     static parser *instance()
     {
index 8b1eda6c15fb6f4063cc9658e9ac903c57ecde23..a7dd5e3f0eed13a90ff2b20ab3eeebfefdfdb711 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -30,9 +30,9 @@
 
 enum optionIndex {
   UNKNOWN, HELP
-  ,UML,ERULE
   ,FICHIER,OUTPUT,INCLUDE
-  ,PLANG,OPTMODE,COMMENT,CODEC,OPTSPLIT,OPTDBG,OPT_END};
+  ,PLANG,UML,ERULE,COMMENT,CODEC,OPTSPLIT
+  ,OPTMODE,OPTSTD,OPTDBG,OPT_END};
 /*----------------------------------------------------------------------------*/
 const option::Descriptor usage[] = {
  {UNKNOWN,      0, "", "", option::Arg::None,"Welcome to asn1p compiler (c) aeb"
@@ -40,32 +40,50 @@ const option::Descriptor usage[] = {
                    "Usage asn1p [options]\n\texample:"
                    " asn1p -e ber -f toto.asn1 -I[path]\n"},
  {HELP,         0, "h", "help", option::Arg::None,"--help,-h \tPrint help and quit."},
- {UML,          0, "u", "uml" , option::Arg::Optional,"--uml,-u \t"
-                   "Generate UML model of asn1 model."},
- {ERULE,        0, "e", "ecoding_rule",  option::Arg::Required,"--encoding_rule ,-e \t"
-                   " Encoding rules to use"
-                   " accepted ER: ber,per,oer,jer,xer "},
  {FICHIER,      0, "f", "file", option::Arg::Required,"--file,-f \t"
                    "Asn1 or Mib input file to parse"},
  {OUTPUT,       0, "o", "ouput", option::Arg::Required,"--output,-o \t"
                    "output file without extension to be generated"},
  {INCLUDE,      0, "I", "include",     option::Arg::Required,"--include,-I\t"
-                   "Include path to look for other asn1 files."},
+                   "Include path to look for other asn1 files.\n"
+                   "\nCode Generation Options\n"
+                   "-----------------------"
+                },
  {PLANG,        0, "l", "language",     option::Arg::Required,"--language,-l\t"
                    "Programming language generated: cpp, uml, javascript, lds, sql [default: cpp]"},
- {OPTMODE,      0, "m", "mode", option::Arg::Required,"--mode,-m \t"
-                   "Parsing mode. asn1 or mib. Default is asn1"},
+ {UML,          0, "u", "uml" , option::Arg::Optional,"--uml,-u \t"
+                   "Generate UML model of asn1 model."},
+ {ERULE,        0, "e", "ecoding_rule",  option::Arg::Required,"--encoding_rule ,-e \t"
+                   "Encoding rules to use"
+                   " accepted ER: ber,per,oer,jer,xer "},
  {COMMENT,      0, "n", "comment",     option::Arg::Required,"--comment,-n\t"
-                "(true or ON)/(false or OFF) generate comment in source def true"},
+                   "Generate comment in source"
+                   "(true or ON)/(false or OFF)"
+                   " default true"},
  {CODEC,        0, "c", "codec",     option::Arg::Required,"--codec,-c\tCodecs"
                    " functions ON or OFF [default: OFF]"
  },
  {OPTSPLIT,     0, "s", "split",     option::Arg::None,"--split,-s\t"
-                   " put codec code in separated cpp files."
-                   " Needed for huge definitions"
+                   "Put codec code in separated cpp files."
+                   " Needed for huge definitions\n"
+                   "Parsing options\n"
+                   "---------------"
  },
- {OPTDBG,       0, "d", "debug",     option::Arg::Required,"--debug,-d\tconsole=1 "
-                   " msg=1 debug messages in code parser=<1-8> parser debug traces"},
+ {OPTMODE,      0, "m", "mode", option::Arg::Required,"--mode,-m \t"
+                   "Parsing mode. asn1 or mib. Default is asn1"
+                },
+ {OPTSTD,       0, "x", "standard", option::Arg::Required,"--standard,-x \t"
+                   "Supported itu standards X.680 X.681 X.682 X.683\n"
+                   "\tx.680 basic notation default on\n"
+                   "\tx.681 Information object specification\n"
+                   "\tx.682 Constraint specification\n"
+                   "\tx.683 Parameterization of ASN1 Specification\n"
+                },
+ {OPTDBG,       0, "d", "debug", option::Arg::Required, "--debug,-d\t"
+                   "Set debug options\n"
+                   "\tconsole=1 output traces to stdout\n"
+                   "\tmsg=1 debug messages in code\n"
+                   "\tparser=<1-8> parser debug traces"},
  {0,0,0,0,0,0}
 };