Changeset 15275


Ignore:
Timestamp:
2013-02-22T13:28:51+01:00 (11 years ago)
Author:
lochel
Message:
  • revise command line arguments for c-runtime (third part)
    • better warnings. If a flag is used twice, we will now report an error. Previously we considered only the first one without any notification.
    • consistence check. If new flags are added without a description, we get an error (during simulation – that should be improved to an error during compilation).
    • it is no longer possible to introduce flags that do not occur in the help-text
    • now all flags (with values) can be used with <-f=value> as well as <-f value>
    • new debug-output to verify used and interpreted command line options (runtime needs to be compiled with #define USE_DEBUG_OUTPUT)
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/runtime/systemimpl.c

    r15269 r15275  
    20962096      cur += snprintf(cur, 8191-(buf-cur), "<-%s>\n  %s\n", FLAG_NAME[i], desc[i]);
    20972097    } else if (FLAG_TYPE[i] == FLAG_TYPE_OPTION) {
    2098       cur += snprintf(cur, 8191-(buf-cur), "<-%s=value>\n  %s\n", FLAG_NAME[i], desc[i]);
    2099     } else if (FLAG_TYPE[i] == FLAG_TYPE_FLAG_VALUE) {
    2100       cur += snprintf(cur, 8191-(buf-cur), "<-%s value>\n  %s\n", FLAG_NAME[i], desc[i]);
     2098      cur += snprintf(cur, 8191-(buf-cur), "<-%s=value> or <-%s value>\n  %s\n", FLAG_NAME[i], FLAG_NAME[i], desc[i]);
    21012099    } else {
    21022100      cur += snprintf(cur, 8191-(buf-cur), "[unknown flag-type] <-%s>\n", FLAG_NAME[i]);
  • trunk/SimulationRuntime/c/simulation/options.c

    r15253 r15275  
    3535#include <stdio.h>
    3636
     37int flagSet(const char*, int, char**);                        /* -f */
     38int optionSet(const char *option, int argc, char** argv);     /* -f=value */
     39const char* getOption(const char*, int, char **);             /* -f=value; returns NULL if not found */
     40const char* getFlagValue(const char *, int , char **);        /* -f value; returns NULL if not found */
     41
     42int omc_flag[FLAG_MAX];
     43char *omc_flagValue[FLAG_MAX];
     44
    3745int checkCommandLineArguments(int argc, char **argv)
    3846{
    3947  int i,j;
     48 
     49  /* This works not that well - but is probably better than no check */
     50  ASSERT(!strcmp(FLAG_NAME[FLAG_MAX], "FLAG_MAX"), "unbalanced command line flag structure: FLAG_NAME");
     51  ASSERT(!strcmp(FLAG_DESC[FLAG_MAX], "FLAG_MAX"), "unbalanced command line flag structure: FLAG_DESC");
     52  ASSERT(!strcmp(FLAG_DETAILED_DESC[FLAG_MAX], "FLAG_MAX"), "unbalanced command line flag structure: FLAG_DETAILED_DESC");
     53 
     54  for(i=0; i<FLAG_MAX; ++i)
     55  {
     56    omc_flag[i] = 0;
     57    omc_flagValue[i] = NULL;
     58  }
     59 
     60#ifdef USE_DEBUG_OUTPUT
     61  DEBUG(LOG_STDOUT, "used command line options");
     62  INDENT(LOG_STDOUT);
    4063  for(i=1; i<argc; ++i)
    41   {
     64    DEBUG1(LOG_STDOUT, "%s", argv[i]);
     65  RELEASE(LOG_STDOUT);
     66 
     67  DEBUG(LOG_STDOUT, "interpreted command line options");
     68#endif
     69 
     70  for(i=1; i<argc; ++i)
     71  {
    4272    int found=0;
     73   
    4374    for(j=1; j<FLAG_MAX; ++j)
    4475    {
    45       if (((FLAG_TYPE[j] == FLAG_TYPE_FLAG) && flagSet(FLAG_NAME[j],1,argv+i)) ||
    46           ((FLAG_TYPE[j] == FLAG_TYPE_FLAG_VALUE) && flagSet(FLAG_NAME[j],1,argv+i) && (++i < argc)) ||
    47           ((FLAG_TYPE[j] == FLAG_TYPE_OPTION) && optionSet(FLAG_NAME[j],1,argv+i))) {
     76      if ((FLAG_TYPE[j] == FLAG_TYPE_FLAG) && flagSet(FLAG_NAME[j], 1, argv+i))
     77      {
     78        if(omc_flag[j])
     79        {
     80          WARNING1(LOG_STDOUT, "each command line option can only be used once: %s", argv[i]);
     81          return 1;
     82        }
     83       
     84        omc_flag[j] = 1;
    4885        found=1;
     86       
     87#ifdef USE_DEBUG_OUTPUT
     88        INDENT(LOG_STDOUT);
     89        DEBUG1(LOG_STDOUT, "-%s", FLAG_NAME[j]);
     90        RELEASE(LOG_STDOUT);
     91#endif
     92
     93        break;
     94      }
     95      else if((FLAG_TYPE[j] == FLAG_TYPE_OPTION) && flagSet(FLAG_NAME[j], 1, argv+i) && (i+1 < argc))
     96      {
     97        if(omc_flag[j])
     98        {
     99          WARNING1(LOG_STDOUT, "each command line option can only be used once: %s", argv[i]);
     100          return 1;
     101        }
     102       
     103        omc_flag[j] = 1;
     104        omc_flagValue[j] = (char*)getFlagValue(FLAG_NAME[j], 1, argv+i);
     105        i++;
     106        found=1;
     107       
     108#ifdef USE_DEBUG_OUTPUT
     109        INDENT(LOG_STDOUT);
     110        DEBUG2(LOG_STDOUT, "-%s %s", FLAG_NAME[j], omc_flagValue[j]);
     111        RELEASE(LOG_STDOUT);
     112#endif
     113
     114        break;
     115      }
     116      else if((FLAG_TYPE[j] == FLAG_TYPE_OPTION) && optionSet(FLAG_NAME[j], 1, argv+i))
     117      {
     118        if(omc_flag[j])
     119        {
     120          WARNING1(LOG_STDOUT, "each command line option can only be used once: %s", argv[i]);
     121          return 1;
     122        }
     123       
     124        omc_flag[j] = 1;
     125        omc_flagValue[j] = (char*)getOption(FLAG_NAME[j], 1, argv+i);
     126        found=1;
     127       
     128#ifdef USE_DEBUG_OUTPUT
     129        INDENT(LOG_STDOUT);
     130        DEBUG2(LOG_STDOUT, "-%s=%s", FLAG_NAME[j], omc_flagValue[j]);
     131        RELEASE(LOG_STDOUT);
     132#endif
    49133        break;
    50134      }
    51135    }
    52     if (!found) {
     136   
     137    if(!found)
     138    {
    53139      WARNING1(LOG_STDOUT, "invalid command line option: %s", argv[i]);
    54140      return 1;
     
    62148{
    63149  int i;
    64   for (i=0; i<argc;i++)
     150  for(i=0; i<argc; i++)
    65151  {
    66     if (argv[i][0] == '-' && 0==strcmp(option,argv[i]+1))
     152    if((argv[i][0] == '-') && (0 == strcmp(option, argv[i]+1)))
    67153      return 1;
    68154  }
     
    70156}
    71157
     158int helpFlagSet(int argc, char** argv)
     159{
     160  return flagSet("?", argc, argv) || flagSet("help", argc, argv);
     161}
     162
    72163int optionSet(const char *option, int argc, char** argv)
    73164{
    74   return getOption(option,argc,argv) != NULL;
     165  return getOption(option, argc, argv) != NULL;
    75166}
    76167
     
    79170{
    80171  int optLen = strlen(option), i;
    81   for (i=0; i<argc;i++) {
    82     if (argv[i][0] == '-' && 0==strncmp(option,argv[i]+1,optLen) && argv[i][optLen+1]=='=') {
    83       return argv[i]+optLen+2;
    84     }
     172  for(i=0; i<argc; i++)
     173  {
     174    if((argv[i][0] == '-') && (0 == strncmp(option, argv[i]+1, optLen)) && (argv[i][optLen+1] == '='))
     175      return argv[i] + optLen + 2;
    85176  }
    86177  return NULL;
     
    91182{
    92183  int i;
    93   for(i=0; i<argc-1;i++)
     184  for(i=0; i<argc; i++)
    94185  {
    95     if (argv[i][0] == '-' && 0==strcmp(option,argv[i]+1))
     186    if((argv[i][0] == '-') && (0 == strcmp(option, argv[i]+1)))
    96187      return argv[i+1];
    97188  }
  • trunk/SimulationRuntime/c/simulation/options.h

    r15253 r15275  
    3636
    3737#ifdef __cplusplus
    38 extern "C" {
     38  extern "C" {
    3939#endif
     40
     41extern int omc_flag[FLAG_MAX];
     42extern char *omc_flagValue[FLAG_MAX];
     43
     44int helpFlagSet(int argc, char** argv);
    4045int checkCommandLineArguments(int argc, char **argv);
    4146
    42 int flagSet(const char*, int, char**);                        /* -f */
    43 int optionSet(const char *option, int argc, char** argv);     /* -f=value */
    44 const char* getOption(const char*, int, char **);      /* -f=value; returns NULL if not found */
    45 const char* getFlagValue(const char *, int , char **); /* -f value; returns NULL if not found */
    4647#ifdef __cplusplus
    47 }
     48  }
    4849#endif
    4950
  • trunk/SimulationRuntime/c/simulation/simulation_input_xml.cpp

    r15268 r15275  
    222222
    223223  /* read the filename from the command line (if any) */
    224   if (optionSet("f",argc,argv)) {
    225     filename = getOption("f",argc,argv);
     224  if(omc_flag[FLAG_F]) {
     225    filename = omc_flagValue[FLAG_F];
    226226  } else {
    227227    /* no file given on the command line? use the default */
     
    284284
    285285  // deal with override
    286   const char* override = getFlagValue("override", argc, argv);
    287   const char* overrideFile = getFlagValue("overrideFile", argc, argv);
     286  const char* override = omc_flagValue[FLAG_OVERRIDE];
     287  const char* overrideFile = omc_flagValue[FLAG_OVERRIDE_FILE];
    288288  doOverride(mi, modelData, override, overrideFile);
    289289
  • trunk/SimulationRuntime/c/simulation/simulation_runtime.cpp

    r15259 r15275  
    156156void setGlobalVerboseLevel(int argc, char**argv)
    157157{
    158   const char *cflags = getOption("lv", argc, argv);
     158  const char *cflags = omc_flagValue[FLAG_LV];
    159159  const string *flags = cflags ? new string(cflags) : NULL;
    160160  int i;
    161161  int error;
    162162 
    163   if(flagSet("w", argc, argv))
     163  if(omc_flag[FLAG_W])
    164164    showAllWarnings = 1;
    165165
     
    251251int getNonlinearSolverMethod(int argc, char**argv)
    252252{
    253   const char *cflags = getOption("nls", argc, argv);
     253  const char *cflags = omc_flagValue[FLAG_NLS];
    254254  const string *method = cflags ? new string(cflags) : NULL;
    255255
     
    276276int getlinearSolverMethod(int argc, char**argv)
    277277{
    278   const char *cflags = getOption("ls", argc, argv);
     278  const char *cflags = omc_flagValue[FLAG_LS];
    279279  const string *method = cflags ? new string(cflags) : NULL;
    280280
     
    385385
    386386  /* linear model option is set : <-l lintime> */
    387   int create_linearmodel = optionSet("l", argc, argv);
    388   const char* lintime = getOption("l", argc, argv);
     387  int create_linearmodel = omc_flag[FLAG_L];
     388  const char* lintime = omc_flagValue[FLAG_L];
    389389
    390390  /* activated measure time option with LOG_STATS */
    391   if((ACTIVE_STREAM(LOG_STATS) || flagSet("cpu", argc, argv)) && !measure_time_flag)
     391  if(ACTIVE_STREAM(LOG_STATS) || omc_flag[FLAG_CPU] && !measure_time_flag)
    392392  {
    393393    measure_time_flag = 1;
     
    401401    enum omc_rt_clock_t clock = OMC_CLOCK_REALTIME;
    402402    const char *clockName;
    403     if (clockName=getOption("clock",argc,argv)) {
    404       if (0==strcmp(clockName,"CPU")) {
     403    if (clockName=omc_flagValue[FLAG_CLOCK]) {
     404      if (0==strcmp(clockName, "CPU")) {
    405405        clock = OMC_CLOCK_CPUTIME;
    406       } else if (0==strcmp(clockName,"RT")) {
     406      } else if (0==strcmp(clockName, "RT")) {
    407407        clock = OMC_CLOCK_REALTIME;
    408408      } else {
     
    435435  }
    436436
    437   if(optionSet("s", argc, argv))
    438   {
    439     const string *method = new string(getOption("s", argc, argv));
     437  if(omc_flag[FLAG_S])
     438  {
     439    const string *method = new string(omc_flagValue[FLAG_S]);
    440440    if(method)
    441441    {
     
    446446
    447447  // Create a result file
    448   const char *result_file = getOption("r", argc, argv);
     448  const char *result_file = omc_flagValue[FLAG_R];
    449449  string result_file_cstr;
    450450  if(!result_file)
     
    461461  int init_lambda_steps = 5;
    462462  string outputVariablesAtEnd = "";
    463   int cpuTime = flagSet("cpu", argc, argv);
    464 
    465   if(optionSet("iim", argc, argv)) {
    466     init_initMethod = getOption("iim", argc, argv);
    467   }
    468   if(optionSet("iom", argc, argv)) {
    469     init_optiMethod = getOption("iom", argc, argv);
    470   }
    471   if(optionSet("iif", argc, argv)) {
    472     init_file = getOption("iif", argc, argv);
    473   }
    474   if(optionSet("iit", argc, argv))
    475   {
    476     init_time_string = getOption("iit", argc, argv);
     463  int cpuTime = omc_flag[FLAG_CPU];
     464
     465  if(omc_flag[FLAG_IIM])
     466  {
     467    init_initMethod = omc_flagValue[FLAG_IIM];
     468  }
     469  if(omc_flag[FLAG_IOM])
     470  {
     471    init_optiMethod = omc_flagValue[FLAG_IOM];
     472  }
     473  if(omc_flag[FLAG_IIF])
     474  {
     475    init_file = omc_flagValue[FLAG_IIF];
     476  }
     477  if(omc_flag[FLAG_IIT])
     478  {
     479    init_time_string = omc_flagValue[FLAG_IIT];
    477480    init_time = atof(init_time_string.c_str());
    478481  }
    479   if(optionSet("ils", argc, argv))
    480   {
    481     init_lambda_steps_string = getOption("ils", argc, argv);
     482  if(omc_flag[FLAG_ILS])
     483  {
     484    init_lambda_steps_string = omc_flagValue[FLAG_ILS];
    482485    init_lambda_steps = atoi(init_lambda_steps_string.c_str());
    483486  }
    484 
    485   if(flagSet("output", argc, argv)) {
    486     outputVariablesAtEnd = getFlagValue("output", argc, argv);
     487  if(omc_flag[FLAG_OUTPUT])
     488  {
     489    outputVariablesAtEnd = omc_flagValue[FLAG_OUTPUT];
    487490  }
    488491
     
    512515    const string plotFile = string(data->modelData.modelFilePrefix) + "_prof.plt";
    513516    rt_accumulate(SIM_TIMER_TOTAL);
    514     const char* plotFormat = getOption("measureTimePlotFormat", argc, argv);
     517    const char* plotFormat = omc_flagValue[FLAG_MEASURETIMEPLOTFORMAT];
    515518    retVal = printModelInfo(data, modelInfo.c_str(), plotFile.c_str(), plotFormat ? plotFormat : "svg",
    516519        data->simulationInfo.solverMethod, data->simulationInfo.outputFormat, result_file_cstr.c_str()) && retVal;
     
    665668  initDumpSystem();
    666669
    667   if(flagSet("?", argc, argv) || flagSet("help", argc, argv) || checkCommandLineArguments(argc, argv))
     670  if(helpFlagSet(argc, argv) || checkCommandLineArguments(argc, argv))
    668671  {
    669672    INFO1(LOG_STDOUT, "usage: %s", argv[0]);
     
    675678        INFO2(LOG_STDOUT, "<-%s>\n  %s", FLAG_NAME[i], FLAG_DESC[i]);
    676679      else if(FLAG_TYPE[i] == FLAG_TYPE_OPTION)
    677         INFO2(LOG_STDOUT, "<-%s=value>\n  %s", FLAG_NAME[i], FLAG_DESC[i]);
    678       else if(FLAG_TYPE[i] == FLAG_TYPE_FLAG_VALUE)
    679         INFO2(LOG_STDOUT, "<-%s value>\n  %s", FLAG_NAME[i], FLAG_DESC[i]);
     680        INFO3(LOG_STDOUT, "<-%s=value> or <-%s value>\n  %s", FLAG_NAME[i], FLAG_NAME[i], FLAG_DESC[i]);
    680681      else
    681682        WARNING1(LOG_STDOUT, "[unknown flag-type] <-%s>", FLAG_NAME[i]);
     
    686687  }
    687688 
    688   if(optionSet("help", argc, argv))
    689   {
    690     std::string option = getOption("help", argc, argv);
     689  if(omc_flag[FLAG_HELP])
     690  {
     691    std::string option = omc_flagValue[FLAG_HELP];
    691692   
    692693    for(i=1; i<FLAG_MAX; ++i)
     
    697698          INFO2(LOG_STDOUT, "detaild flag-description for: <-%s>\n%s", FLAG_NAME[i], FLAG_DETAILED_DESC[i]);
    698699        else if(FLAG_TYPE[i] == FLAG_TYPE_OPTION)
    699           INFO2(LOG_STDOUT, "detaild flag-description for: <-%s=value>\n%s", FLAG_NAME[i], FLAG_DETAILED_DESC[i]);
    700         else if(FLAG_TYPE[i] == FLAG_TYPE_FLAG_VALUE)
    701           INFO2(LOG_STDOUT, "detaild flag-description for: <-%s value>\n%s", FLAG_NAME[i], FLAG_DETAILED_DESC[i]);
     700          INFO3(LOG_STDOUT, "detaild flag-description for: <-%s=value> or <-%s value>\n%s", FLAG_NAME[i], FLAG_NAME[i], FLAG_DETAILED_DESC[i]);
    702701        else
    703702          WARNING1(LOG_STDOUT, "[unknown flag-type] <-%s>", FLAG_NAME[i]);
     
    751750  }
    752751
    753   /* verbose flag is set : -v */
    754   if(flagSet("v", argc, argv))
    755     useStream[LOG_STATS] = 1;
    756   sim_noemit = flagSet("noemit", argc, argv);
    757 
     752  sim_noemit = omc_flag[FLAG_NOEMIT];
    758753
    759754  // ppriv - NO_INTERACTIVE_DEPENDENCY - for simpler debugging in Visual Studio
    760755
    761756#ifndef NO_INTERACTIVE_DEPENDENCY
    762   interactiveSimulation = flagSet("interactive", argc, argv);
    763   if(interactiveSimulation && flagSet("port", argc, argv)) {
     757  interactiveSimulation = omc_flag[FLAG_INTERACTIVE];
     758  if(interactiveSimulation && omc_flag[FLAG_PORT])
     759  {
    764760    cout << "userPort" << endl;
    765     const char *portvalue = getOption("port", argc, argv);
    766     std::istringstream stream(portvalue);
     761    std::istringstream stream(omc_flagValue[FLAG_PORT]);
    767762    int userPort;
    768763    stream >> userPort;
    769764    setPortOfControlServer(userPort);
    770   } else if(!interactiveSimulation && flagSet("port", argc, argv))
    771   {
    772     const char *portvalue = getOption("port", argc, argv);
    773     std::istringstream stream(portvalue);
     765  }
     766  else if(!interactiveSimulation && omc_flag[FLAG_PORT])
     767  {
     768    std::istringstream stream(omc_flagValue[FLAG_PORT]);
    774769    int port;
    775770    stream >> port;
  • trunk/SimulationRuntime/c/util/simulation_options.c

    r15253 r15275  
    3131#include "simulation_options.h"
    3232
    33 const char *FLAG_NAME[FLAG_MAX] = {
    34   "LOG_UNKNOWN",
     33const char *FLAG_NAME[FLAG_MAX+1] = {
     34  "FLAG_UNKNOWN",
     35 
    3536  /* FLAG_CLOCK */                 "clock",
    3637  /* FLAG_CPU */                   "cpu",
     
    4445  /* FLAG_IOM */                   "iom",
    4546  /* FLAG_L */                     "l",
     47  /* FLAG_LS */                    "ls",
    4648  /* FLAG_LV */                    "lv",
    4749  /* FLAG_MEASURETIMEPLOTFORMAT */ "measureTimePlotFormat",
     
    5456  /* FLAG_R */                     "r",
    5557  /* FLAG_S */                     "s",
    56   /* FLAG_W */                     "w"
     58  /* FLAG_W */                     "w",
     59 
     60  "FLAG_MAX"
    5761};
    5862
    59 const char *FLAG_DESC[FLAG_MAX] = {
     63const char *FLAG_DESC[FLAG_MAX+1] = {
    6064  "unknown",
     65 
    6166  /* FLAG_CLOCK */                 "selects the type of clock to use -clock=RT or -clock=CPU",
    6267  /* FLAG_CPU */                   "dumps the cpu-time into the results-file",
     
    7075  /* FLAG_IOM */                   "value specifies the initialization optimization method",
    7176  /* FLAG_L */                     "value specifies a time where the linearization of the model should be performed",
     77  /* FLAG_LS */                    "value specifies the linear solver method",
    7278  /* FLAG_LV */                    "[string list] value specifies the logging level",
    7379  /* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality",
     
    8086  /* FLAG_R */                     "value specifies a new result file than the default Model_res.mat",
    8187  /* FLAG_S */                     "value specifies the solver",
    82   /* FLAG_W */                     "shows all warnings even if a related log-stream is inactive"
     88  /* FLAG_W */                     "shows all warnings even if a related log-stream is inactive",
     89 
     90  "FLAG_MAX"
    8391};
    8492
    85 const char *FLAG_DETAILED_DESC[FLAG_MAX] = {
     93const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
    8694  "unknown",
    8795
     
    97105  /* FLAG_IOM */                   "value specifies the initialization optimization method\n  nelder_mead_ex\n  nelder_mead_ex2\n  simplex\n  newuoa",
    98106  /* FLAG_L */                     "value specifies a time where the linearization of the model should be performed",
     107  /* FLAG_LS */                    "value specifies the linear solver method\n  lapack",
    99108  /* FLAG_LV */                    "value specifies the logging level",
    100109  /* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality\n  svg\n  jpg\n  ps\n  gif\n  ...",
     
    107116  /* FLAG_R */                     "value specifies a new result file than the default Model_res.mat",
    108117  /* FLAG_S */                     "value specifies the solver\n  dassl\n  euler\n  rungekutta\n  inline-euler\n  inline-rungekutta\n  dasslwort\n  dasslSymJac\n  dasslNumJac\n  dasslColorSymJac\n  dasslInternalNumJac\n  qss",
    109   /* FLAG_W */                     "shows all warnings even if a related log-stream is inactive"
     118  /* FLAG_W */                     "shows all warnings even if a related log-stream is inactive",
     119 
     120  "FLAG_MAX"
    110121};
    111122
     
    124135  /* FLAG_IOM */                   FLAG_TYPE_OPTION,
    125136  /* FLAG_L */                     FLAG_TYPE_OPTION,
     137  /* FLAG_LS */                    FLAG_TYPE_OPTION,
    126138  /* FLAG_LV */                    FLAG_TYPE_OPTION,
    127139  /* FLAG_MEASURETIMEPLOTFORMAT */ FLAG_TYPE_OPTION,
    128140  /* FLAG_NLS */                   FLAG_TYPE_OPTION,
    129141  /* FLAG_NOEMIT */                FLAG_TYPE_FLAG,
    130   /* FLAG_OUTPUT */                FLAG_TYPE_FLAG_VALUE,
    131   /* FLAG_OVERRIDE */              FLAG_TYPE_FLAG_VALUE,
    132   /* FLAG_OVERRIDE_FILE */         FLAG_TYPE_FLAG_VALUE,
     142  /* FLAG_OUTPUT */                FLAG_TYPE_OPTION,
     143  /* FLAG_OVERRIDE */              FLAG_TYPE_OPTION,
     144  /* FLAG_OVERRIDE_FILE */         FLAG_TYPE_OPTION,
    133145  /* FLAG_PORT */                  FLAG_TYPE_OPTION,
    134146  /* FLAG_R */                     FLAG_TYPE_OPTION,
     
    136148  /* FLAG_W */                     FLAG_TYPE_FLAG
    137149};
    138 
    139 
  • trunk/SimulationRuntime/c/util/simulation_options.h

    r15253 r15275  
    3434
    3535#if defined(__cplusplus)
    36 extern "C" {
     36  extern "C" {
    3737#endif
    3838
     
    5252  FLAG_IOM,
    5353  FLAG_L,
     54  FLAG_LS,
    5455  FLAG_LV,
    5556  FLAG_MEASURETIMEPLOTFORMAT,
     
    7273 
    7374  FLAG_TYPE_FLAG,         /* e.g. -f */
    74   FLAG_TYPE_OPTION,       /* e.g. -f=value */
    75   FLAG_TYPE_FLAG_VALUE,   /* e.g. -f value */
     75  FLAG_TYPE_OPTION,       /* e.g. -f=value or -f value */
    7676 
    7777  FLAG_TYPE_MAX
    7878};
    7979
    80 extern const char *FLAG_NAME[FLAG_MAX];
    81 extern const char *FLAG_DESC[FLAG_MAX];
    82 extern const char *FLAG_DETAILED_DESC[FLAG_MAX];
     80extern const char *FLAG_NAME[FLAG_MAX+1];
     81extern const char *FLAG_DESC[FLAG_MAX+1];
     82extern const char *FLAG_DETAILED_DESC[FLAG_MAX+1];
    8383extern const int FLAG_TYPE[FLAG_MAX];
    8484
    8585#if defined(__cplusplus)
    86 }
     86  }
    8787#endif
    8888
Note: See TracChangeset for help on using the changeset viewer.