Commit ab4bb292 authored by Lev Walkin's avatar Lev Walkin

-print-constraints

parent 6b955c68
...@@ -28,7 +28,7 @@ main(int ac, char **av) { ...@@ -28,7 +28,7 @@ main(int ac, char **av) {
enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS; enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS;
enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS; enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS;
enum asn1c_flags asn1_compiler_flags= A1C_NOFLAGS; enum asn1c_flags asn1_compiler_flags= A1C_NOFLAGS;
enum asn1print_flags_e asn1_print_flags = APF_NOFLAGS; enum asn1print_flags asn1_printer_flags = APF_NOFLAGS;
int print_arg__print_out = 0; /* Don't compile, just print parsed */ int print_arg__print_out = 0; /* Don't compile, just print parsed */
int print_arg__fix_n_print = 0; /* Fix and print */ int print_arg__fix_n_print = 0; /* Fix and print */
int warnings_as_errors = 0; /* Treat warnings as errors */ int warnings_as_errors = 0; /* Treat warnings as errors */
...@@ -41,7 +41,7 @@ main(int ac, char **av) { ...@@ -41,7 +41,7 @@ main(int ac, char **av) {
/* /*
* Process command-line options. * Process command-line options.
*/ */
while((ch = getopt(ac, av, "EFf:LPRS:t:W:")) != -1) while((ch = getopt(ac, av, "EFf:LPp:RS:t:W:")) != -1)
switch(ch) { switch(ch) {
case 'E': case 'E':
print_arg__print_out = 1; print_arg__print_out = 1;
...@@ -70,11 +70,19 @@ main(int ac, char **av) { ...@@ -70,11 +70,19 @@ main(int ac, char **av) {
} }
break; break;
case 'L': case 'L':
asn1_print_flags |= APF_LINE_COMMENTS; asn1_printer_flags |= APF_LINE_COMMENTS;
break; break;
case 'P': case 'P':
asn1_compiler_flags |= A1C_PRINT_COMPILED; asn1_compiler_flags |= A1C_PRINT_COMPILED;
break; break;
case 'p':
if(strcmp(optarg, "rint-constraints") == 0) {
asn1_printer_flags |= APF_DEBUG_CONSTRAINTS;
} else {
fprintf(stderr, "-p%s: Invalid argument\n", optarg);
exit(EX_USAGE);
}
break;
case 'R': case 'R':
asn1_compiler_flags |= A1C_OMIT_SUPPORT_CODE; asn1_compiler_flags |= A1C_OMIT_SUPPORT_CODE;
break; break;
...@@ -115,6 +123,12 @@ main(int ac, char **av) { ...@@ -115,6 +123,12 @@ main(int ac, char **av) {
fprintf(stderr, "Error: -F requires -E\n"); fprintf(stderr, "Error: -F requires -E\n");
exit(EX_USAGE); exit(EX_USAGE);
} }
if(asn1_printer_flags) {
fprintf(stderr, "Error: "
"-L and -print-constraints "
"require -E\n");
exit(EX_USAGE);
}
} }
/* /*
...@@ -160,7 +174,7 @@ main(int ac, char **av) { ...@@ -160,7 +174,7 @@ main(int ac, char **av) {
* Dump the parsed ASN.1 tree if -E specified and -F is NOT given. * Dump the parsed ASN.1 tree if -E specified and -F is NOT given.
*/ */
if(print_arg__print_out && !print_arg__fix_n_print) { if(print_arg__print_out && !print_arg__fix_n_print) {
if(asn1print(asn, asn1_print_flags)) if(asn1print(asn, asn1_printer_flags))
exit(EX_SOFTWARE); exit(EX_SOFTWARE);
return 0; return 0;
} }
...@@ -187,7 +201,7 @@ main(int ac, char **av) { ...@@ -187,7 +201,7 @@ main(int ac, char **av) {
* Dump the parsed ASN.1 tree if -E specified and -F is given. * Dump the parsed ASN.1 tree if -E specified and -F is given.
*/ */
if(print_arg__print_out && print_arg__fix_n_print) { if(print_arg__print_out && print_arg__fix_n_print) {
if(asn1print(asn, asn1_print_flags)) if(asn1print(asn, asn1_printer_flags))
exit(EX_SOFTWARE); exit(EX_SOFTWARE);
return 0; return 0;
} }
...@@ -265,6 +279,8 @@ usage(char *av0) { ...@@ -265,6 +279,8 @@ usage(char *av0) {
"\t-fno-c99\tDisable C99 extensions\n" "\t-fno-c99\tDisable C99 extensions\n"
"\t-funnamed-unions\tEnable unnamed unions in structures\n" "\t-funnamed-unions\tEnable unnamed unions in structures\n"
"\n" "\n"
"\t-print-constraints\tExplain subtype constraints (debug)\n"
"\n"
"\t-Werror \tTreat warnings as errors; abort if any warning\n" "\t-Werror \tTreat warnings as errors; abort if any warning\n"
"\t-Wdebug-lexer\tEnable verbose debugging output from lexer\n" "\t-Wdebug-lexer\tEnable verbose debugging output from lexer\n"
"\t-Wdebug-fixer\tDebug ASN.1 semantics processor\n" "\t-Wdebug-fixer\tDebug ASN.1 semantics processor\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment