📄 cmdline.c
字号:
/* File autogenerated by gengetopt version 2.7.1 generated with the following command: ../helpers/bin/gengetopt -ihysdel.ggo The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it.*/#include <stdio.h>#include <stdlib.h>#include <string.h>/* If we use autoconf. */#ifdef HAVE_CONFIG_H#include "config.h"#endif/* Check for configure's getopt check result. */#ifndef HAVE_GETOPT_LONG#include "getopt.h"#else#include <getopt.h>#endif#ifndef HAVE_STRDUP#define strdup gengetopt_strdup#endif /* HAVE_STRDUP */#include "cmdline.h"voidcmdline_parser_print_version (void){ printf ("%s %s\n", PACKAGE, VERSION);}voidcmdline_parser_print_help (void){ cmdline_parser_print_version (); printf("\n" "Purpose:\n" " HYSDEL compiler, see http://control.ethz.ch/~hybrid/hysdel for details\n" "\n" "Usage: %s [OPTIONS]...\n", PACKAGE); printf(" -h --help Print help and exit\n"); printf(" -V --version Print version and exit\n"); printf(" -iSTRING --input=STRING HYSDEL input file name (default=stdin)\n"); printf(" -mSTRING --MLDoutput=STRING MLD output file name (without extension)\n"); printf(" -sSTRING --SIMoutput=STRING Simulator file name (without extension)\n"); printf(" -p --parametric Force parametric output\n"); printf(" -a --allow-affine Allow affine state and output functions\n"); printf(" -5 --allow-B5-D5 Allow B5 D5 in MLD form (implies -a)\n"); printf(" --no-symbol-table Omit symbol table information\n"); printf(" --no-row-info Omit row information\n"); printf(" --no-params-checks Omit checks for symbolic parameters\n"); printf(" --matlab-symbolic Use symbolic toolbox for parameters\n"); printf(" -vINT --verbose=INT Verbosity level (0=silent, 3=max) (default=2)\n");}#ifndef HAVE_STRDUP/* gengetopt_strdup(): automatically generated from strdup.c. *//* strdup.c replacement of strdup, which is not standard */static char *gengetopt_strdup (const char *s){ char *result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result;}#endif /* HAVE_STRDUP */intcmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info){ int c; /* Character of the parsed option. */ int missing_required_options = 0; args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->input_given = 0 ; args_info->MLDoutput_given = 0 ; args_info->SIMoutput_given = 0 ; args_info->parametric_given = 0 ; args_info->allow_affine_given = 0 ; args_info->allow_B5_D5_given = 0 ; args_info->no_symbol_table_given = 0 ; args_info->no_row_info_given = 0 ; args_info->no_params_checks_given = 0 ; args_info->matlab_symbolic_given = 0 ; args_info->verbose_given = 0 ;#define clear_args() { \ args_info->input_arg = NULL; \ args_info->MLDoutput_arg = NULL; \ args_info->SIMoutput_arg = NULL; \} clear_args(); optarg = 0; optind = 1; opterr = 1; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "input", 1, NULL, 'i' }, { "MLDoutput", 1, NULL, 'm' }, { "SIMoutput", 1, NULL, 's' }, { "parametric", 0, NULL, 'p' }, { "allow-affine", 0, NULL, 'a' }, { "allow-B5-D5", 0, NULL, '5' }, { "no-symbol-table", 0, NULL, 0 }, { "no-row-info", 0, NULL, 0 }, { "no-params-checks", 0, NULL, 0 }, { "matlab-symbolic", 0, NULL, 0 }, { "verbose", 1, NULL, 'v' }, { NULL, 0, NULL, 0 } }; c = getopt_long (argc, argv, "hVi:m:s:pa5v:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ clear_args (); cmdline_parser_print_help (); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ clear_args (); cmdline_parser_print_version (); exit (EXIT_SUCCESS); case 'i': /* HYSDEL input file name (default=stdin). */ if (args_info->input_given) { fprintf (stderr, "%s: `--input' (`-i') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->input_given = 1; args_info->input_arg = strdup (optarg); break; case 'm': /* MLD output file name (without extension). */ if (args_info->MLDoutput_given) { fprintf (stderr, "%s: `--MLDoutput' (`-m') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->MLDoutput_given = 1; args_info->MLDoutput_arg = strdup (optarg); break; case 's': /* Simulator file name (without extension). */ if (args_info->SIMoutput_given) { fprintf (stderr, "%s: `--SIMoutput' (`-s') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->SIMoutput_given = 1; args_info->SIMoutput_arg = strdup (optarg); break; case 'p': /* Force parametric output. */ if (args_info->parametric_given) { fprintf (stderr, "%s: `--parametric' (`-p') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->parametric_given = 1; break; case 'a': /* Allow affine state and output functions. */ if (args_info->allow_affine_given) { fprintf (stderr, "%s: `--allow-affine' (`-a') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->allow_affine_given = 1; break; case '5': /* Allow B5 D5 in MLD form (implies -a). */ if (args_info->allow_B5_D5_given) { fprintf (stderr, "%s: `--allow-B5-D5' (`-5') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->allow_B5_D5_given = 1; break; case 'v': /* Verbosity level (0=silent, 3=max) (default=2). */ if (args_info->verbose_given) { fprintf (stderr, "%s: `--verbose' (`-v') option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->verbose_given = 1; args_info->verbose_arg = atoi (optarg); break; case 0: /* Long option with no short option */ /* Omit symbol table information. */ if (strcmp (long_options[option_index].name, "no-symbol-table") == 0) { if (args_info->no_symbol_table_given) { fprintf (stderr, "%s: `--no-symbol-table' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->no_symbol_table_given = 1; break; } /* Omit row information. */ else if (strcmp (long_options[option_index].name, "no-row-info") == 0) { if (args_info->no_row_info_given) { fprintf (stderr, "%s: `--no-row-info' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->no_row_info_given = 1; break; } /* Omit checks for symbolic parameters. */ else if (strcmp (long_options[option_index].name, "no-params-checks") == 0) { if (args_info->no_params_checks_given) { fprintf (stderr, "%s: `--no-params-checks' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->no_params_checks_given = 1; break; } /* Use symbolic toolbox for parameters. */ else if (strcmp (long_options[option_index].name, "matlab-symbolic") == 0) { if (args_info->matlab_symbolic_given) { fprintf (stderr, "%s: `--matlab-symbolic' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } args_info->matlab_symbolic_given = 1; break; } case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ exit (EXIT_FAILURE); default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c\n", PACKAGE, c); abort (); } /* switch */ } /* while */ if ( missing_required_options ) exit (EXIT_FAILURE); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -