option.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /** @file option.h
  2. * @brief The header file for the command line option parser
  3. * generated by GNU Gengetopt version 2.22.6
  4. * http://www.gnu.org/software/gengetopt.
  5. * DO NOT modify this file, since it can be overwritten
  6. * @author GNU Gengetopt by Lorenzo Bettini */
  7. #ifndef OPTION_H
  8. #define OPTION_H
  9. /* If we use autoconf. */
  10. #ifdef HAVE_CONFIG_H
  11. #include "config.h"
  12. #endif
  13. #include <stdio.h> /* for FILE */
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif /* __cplusplus */
  17. #ifndef CMDLINE_PARSER_PACKAGE
  18. /** @brief the program name (used for printing errors) */
  19. #define CMDLINE_PARSER_PACKAGE "BGNFCF"
  20. #endif
  21. #ifndef CMDLINE_PARSER_PACKAGE_NAME
  22. /** @brief the complete program name (used for help and version) */
  23. #define CMDLINE_PARSER_PACKAGE_NAME "BGNFCF"
  24. #endif
  25. #ifndef CMDLINE_PARSER_VERSION
  26. /** @brief the program version */
  27. #define CMDLINE_PARSER_VERSION "(version 2)"
  28. #endif
  29. enum enum_circuit { circuit__NULL = -1, circuit_arg_minmaj = 0, circuit_arg_chiffrement, circuit_arg_additionL1, circuit_arg_additionL2, circuit_arg_additionL3, circuit_arg_additionL4, circuit_arg_multiplicationL1, circuit_arg_multiplicationL1L2, circuit_arg_multiplicationL2, circuit_arg_size, circuit_arg_time, circuit_arg_minmaj2, circuit_arg_minmaj3, circuit_arg_demo, circuit_arg_ip, circuit_arg_scalar_product, circuit_arg_time2 };
  30. /** @brief Where the command line options are stored */
  31. struct gengetopt_args_info
  32. {
  33. const char *help_help; /**< @brief Print help and exit help description. */
  34. const char *version_help; /**< @brief Print version and exit help description. */
  35. char * subtitle_arg; /**< @brief Pour indiquer les sous-titres en ligne de commande. */
  36. char * subtitle_orig; /**< @brief Pour indiquer les sous-titres en ligne de commande original value given at command line. */
  37. const char *subtitle_help; /**< @brief Pour indiquer les sous-titres en ligne de commande help description. */
  38. enum enum_circuit circuit_arg; /**< @brief Pour indiquer le circuit de calcul. minmaj=avec précalcul et postcalcul, minmaj2=avec erreur, minmaj3=avec erreur et postcalcul. (default='minmaj'). */
  39. char * circuit_orig; /**< @brief Pour indiquer le circuit de calcul. minmaj=avec précalcul et postcalcul, minmaj2=avec erreur, minmaj3=avec erreur et postcalcul. original value given at command line. */
  40. const char *circuit_help; /**< @brief Pour indiquer le circuit de calcul. minmaj=avec précalcul et postcalcul, minmaj2=avec erreur, minmaj3=avec erreur et postcalcul. help description. */
  41. unsigned int help_given ; /**< @brief Whether help was given. */
  42. unsigned int version_given ; /**< @brief Whether version was given. */
  43. unsigned int subtitle_given ; /**< @brief Whether subtitle was given. */
  44. unsigned int circuit_given ; /**< @brief Whether circuit was given. */
  45. char **inputs ; /**< @brief unamed options (options without names) */
  46. unsigned inputs_num ; /**< @brief unamed options number */
  47. } ;
  48. /** @brief The additional parameters to pass to parser functions */
  49. struct cmdline_parser_params
  50. {
  51. int override; /**< @brief whether to override possibly already present options (default 0) */
  52. int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
  53. int check_required; /**< @brief whether to check that all required options were provided (default 1) */
  54. int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
  55. int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
  56. } ;
  57. /** @brief the purpose string of the program */
  58. extern const char *gengetopt_args_info_purpose;
  59. /** @brief the usage string of the program */
  60. extern const char *gengetopt_args_info_usage;
  61. /** @brief the description string of the program */
  62. extern const char *gengetopt_args_info_description;
  63. /** @brief all the lines making the help output */
  64. extern const char *gengetopt_args_info_help[];
  65. /**
  66. * The command line parser
  67. * @param argc the number of command line options
  68. * @param argv the command line options
  69. * @param args_info the structure where option information will be stored
  70. * @return 0 if everything went fine, NON 0 if an error took place
  71. */
  72. int cmdline_parser (int argc, char **argv,
  73. struct gengetopt_args_info *args_info);
  74. /**
  75. * The command line parser (version with additional parameters - deprecated)
  76. * @param argc the number of command line options
  77. * @param argv the command line options
  78. * @param args_info the structure where option information will be stored
  79. * @param override whether to override possibly already present options
  80. * @param initialize whether to initialize the option structure my_args_info
  81. * @param check_required whether to check that all required options were provided
  82. * @return 0 if everything went fine, NON 0 if an error took place
  83. * @deprecated use cmdline_parser_ext() instead
  84. */
  85. int cmdline_parser2 (int argc, char **argv,
  86. struct gengetopt_args_info *args_info,
  87. int override, int initialize, int check_required);
  88. /**
  89. * The command line parser (version with additional parameters)
  90. * @param argc the number of command line options
  91. * @param argv the command line options
  92. * @param args_info the structure where option information will be stored
  93. * @param params additional parameters for the parser
  94. * @return 0 if everything went fine, NON 0 if an error took place
  95. */
  96. int cmdline_parser_ext (int argc, char **argv,
  97. struct gengetopt_args_info *args_info,
  98. struct cmdline_parser_params *params);
  99. /**
  100. * Save the contents of the option struct into an already open FILE stream.
  101. * @param outfile the stream where to dump options
  102. * @param args_info the option struct to dump
  103. * @return 0 if everything went fine, NON 0 if an error took place
  104. */
  105. int cmdline_parser_dump(FILE *outfile,
  106. struct gengetopt_args_info *args_info);
  107. /**
  108. * Save the contents of the option struct into a (text) file.
  109. * This file can be read by the config file parser (if generated by gengetopt)
  110. * @param filename the file where to save
  111. * @param args_info the option struct to save
  112. * @return 0 if everything went fine, NON 0 if an error took place
  113. */
  114. int cmdline_parser_file_save(const char *filename,
  115. struct gengetopt_args_info *args_info);
  116. /**
  117. * Print the help
  118. */
  119. void cmdline_parser_print_help(void);
  120. /**
  121. * Print the version
  122. */
  123. void cmdline_parser_print_version(void);
  124. /**
  125. * Initializes all the fields a cmdline_parser_params structure
  126. * to their default values
  127. * @param params the structure to initialize
  128. */
  129. void cmdline_parser_params_init(struct cmdline_parser_params *params);
  130. /**
  131. * Allocates dynamically a cmdline_parser_params structure and initializes
  132. * all its fields to their default values
  133. * @return the created and initialized cmdline_parser_params structure
  134. */
  135. struct cmdline_parser_params *cmdline_parser_params_create(void);
  136. /**
  137. * Initializes the passed gengetopt_args_info structure's fields
  138. * (also set default values for options that have a default)
  139. * @param args_info the structure to initialize
  140. */
  141. void cmdline_parser_init (struct gengetopt_args_info *args_info);
  142. /**
  143. * Deallocates the string fields of the gengetopt_args_info structure
  144. * (but does not deallocate the structure itself)
  145. * @param args_info the structure to deallocate
  146. */
  147. void cmdline_parser_free (struct gengetopt_args_info *args_info);
  148. /**
  149. * Checks that all the required options were specified
  150. * @param args_info the structure to check
  151. * @param prog_name the name of the program that will be used to print
  152. * possible errors
  153. * @return
  154. */
  155. int cmdline_parser_required (struct gengetopt_args_info *args_info,
  156. const char *prog_name);
  157. extern const char *cmdline_parser_circuit_values[]; /**< @brief Possible values for circuit. */
  158. #ifdef __cplusplus
  159. }
  160. #endif /* __cplusplus */
  161. #endif /* OPTION_H */