From: Ebersold Date: Mon, 16 May 2022 20:59:50 +0000 (+0200) Subject: Improved help messages in command line. Started code to select supported standards X-Git-Url: https://git.ebersold.fr/?a=commitdiff_plain;h=743816bdec23eaec5f66922b73665d780ad5be28;p=parser%2Fasn1.git Improved help messages in command line. Started code to select supported standards --- diff --git a/libparser/asn1.y b/libparser/asn1.y index 0543511..5d05509 100644 --- a/libparser/asn1.y +++ b/libparser/asn1.y @@ -2208,7 +2208,7 @@ builtin_type: boolean_def | enumerated_def {$$ = $1;} | bit_string_def {$$ = $1;} | real_def {$$ = $1;} - | time_def { $$ = $1;} + | time_def { $$ = $1;} /* TODO this is UsefulType and must be in referenced_type rule */ | octet_string_def {$$ =$1;} | object_def {$$ = $1;} | object_class_def {$$ = $1;} @@ -2611,7 +2611,7 @@ value: builtin_value { /* ReferencedValue */ | defined_value { - ASN_LOG_DEBUG("value: defined_value .."); + ASN_LOG_DEBUG("value: defined_value : %s",$1->name().c_str()); $$->meta_id(asn1::meta::VALUE); asn1::value *v = new asn1::value($1->name()); $$->value(v); @@ -2806,9 +2806,9 @@ constant_set_def: ; -defined_type: /* * More complex types */ +defined_type: /* * More complex types itu X.683 parameterized type */ complex_type_reference T_LBRACET { - ASN_LOG_DEBUG("defined_type: 1 %s start (params:...)",$1->name().c_str()); + ASN_LOG_DEBUG("defined_type: 1 %s start {params:...}",$1->name().c_str()); asn1::parser *p = asn1::parser::instance(); asn1::module *m= (asn1::module *) p->module(); m->enter_context(new asn1::act_parameters()); diff --git a/libparser/asn1_parser.h b/libparser/asn1_parser.h index 6546f2a..8920c61 100644 --- a/libparser/asn1_parser.h +++ b/libparser/asn1_parser.h @@ -18,6 +18,13 @@ class parser typedef std::list listener_list; typedef std::list 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() { diff --git a/main.cpp b/main.cpp index 8b1eda6..a7dd5e3 100644 --- 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} };