tcpliveplay_opts.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpliveplay_opts.h)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions ../../src/tcpliveplay_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 42:1:17 templates.
  10. *
  11. * AutoOpts is a copyrighted work. This header file is not encumbered
  12. * by AutoOpts licensing, but is provided under the licensing terms chosen
  13. * by the tcpliveplay author or copyright holder. AutoOpts is
  14. * licensed under the terms of the LGPL. The redistributable library
  15. * (``libopts'') is licensed under the terms of either the LGPL or, at the
  16. * users discretion, the BSD license. See the AutoOpts and/or libopts sources
  17. * for details.
  18. *
  19. * The tcpliveplay program is copyrighted and licensed
  20. * under the following terms:
  21. *
  22. * Copyright (C) 2012 Yazan Siam, all rights reserved.
  23. * This is free software. It is licensed for use, modification and
  24. * redistribution under the terms of the
  25. * Modified (3 clause) Berkeley Software Distribution License
  26. * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
  27. *
  28. * Redistribution and use in source and binary forms, with or without
  29. * modification, are permitted provided that the following conditions
  30. * are met:
  31. * 1. Redistributions of source code must retain the above copyright
  32. * notice, this list of conditions and the following disclaimer.
  33. * 2. Redistributions in binary form must reproduce the above copyright
  34. * notice, this list of conditions and the following disclaimer in the
  35. * documentation and/or other materials provided with the distribution.
  36. * 3. Neither the name ``Yazan Siam'' nor the name of any other
  37. * contributor may be used to endorse or promote products derived
  38. * from this software without specific prior written permission.
  39. *
  40. * tcpliveplay IS PROVIDED BY Yazan Siam ``AS IS'' AND ANY EXPRESS
  41. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  42. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  43. * ARE DISCLAIMED. IN NO EVENT SHALL Yazan Siam OR ANY OTHER CONTRIBUTORS
  44. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  45. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  46. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  47. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  48. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  49. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  50. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51. */
  52. /**
  53. * This file contains the programmatic interface to the Automated
  54. * Options generated for the tcpliveplay program.
  55. * These macros are documented in the AutoGen info file in the
  56. * "AutoOpts" chapter. Please refer to that doc for usage help.
  57. */
  58. #ifndef AUTOOPTS_TCPLIVEPLAY_OPTS_H_GUARD
  59. #define AUTOOPTS_TCPLIVEPLAY_OPTS_H_GUARD 1
  60. #include "config.h"
  61. #include <autoopts/options.h>
  62. #include <stdarg.h>
  63. #include <stdnoreturn.h>
  64. /**
  65. * Ensure that the library used for compiling this generated header is at
  66. * least as new as the version current when the header template was released
  67. * (not counting patch version increments). Also ensure that the oldest
  68. * tolerable version is at least as old as what was current when the header
  69. * template was released.
  70. */
  71. #define AO_TEMPLATE_VERSION 172033
  72. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  73. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  74. # error option template version mismatches autoopts/options.h header
  75. Choke Me.
  76. #endif
  77. #if GCC_VERSION > 40400
  78. #define NOT_REACHED __builtin_unreachable();
  79. #else
  80. #define NOT_REACHED
  81. #endif
  82. /**
  83. * Enumeration of each option type for tcpliveplay
  84. */
  85. typedef enum {
  86. INDEX_OPT_DBUG = 0,
  87. INDEX_OPT_VERSION = 1,
  88. INDEX_OPT_LESS_HELP = 2,
  89. INDEX_OPT_HELP = 3,
  90. INDEX_OPT_MORE_HELP = 4,
  91. INDEX_OPT_SAVE_OPTS = 5,
  92. INDEX_OPT_LOAD_OPTS = 6
  93. } teOptIndex;
  94. /** count of all options for tcpliveplay */
  95. #define OPTION_CT 7
  96. /**
  97. * Interface defines for all options. Replace "n" with the UPPER_CASED
  98. * option name (as in the teOptIndex enumeration above).
  99. * e.g. HAVE_OPT(DBUG)
  100. */
  101. #define DESC(n) (tcpliveplayOptions.pOptDesc[INDEX_OPT_## n])
  102. /** 'true' if an option has been specified in any way */
  103. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  104. /** The string argument to an option. The argument type must be \"string\". */
  105. #define OPT_ARG(n) (DESC(n).optArg.argString)
  106. /** Mask the option state revealing how an option was specified.
  107. * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
  108. * \a OPTST_DEFINED, \a OPTST_RESET or zero.
  109. */
  110. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  111. /** Count of option's occurrances *on the command line*. */
  112. #define COUNT_OPT(n) (DESC(n).optOccCt)
  113. /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
  114. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  115. /** 'true' if \a HAVE_OPT would yield 'false'. */
  116. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  117. /** 'true' if OPTST_DISABLED bit not set. */
  118. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  119. /** number of stacked option arguments.
  120. * Valid only for stacked option arguments. */
  121. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  122. /** stacked argument vector.
  123. * Valid only for stacked option arguments. */
  124. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  125. /** Reset an option. */
  126. #define CLEAR_OPT(n) STMTS( \
  127. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  128. if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  129. DESC(n).fOptState |= OPTST_DISABLED; \
  130. DESC(n).optCookie = NULL )
  131. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  132. /**
  133. * Enumeration of tcpliveplay exit codes
  134. */
  135. typedef enum {
  136. TCPLIVEPLAY_EXIT_SUCCESS = 0,
  137. TCPLIVEPLAY_EXIT_FAILURE = 1,
  138. TCPLIVEPLAY_EXIT_USAGE_ERROR = 64,
  139. TCPLIVEPLAY_EXIT_NO_CONFIG_INPUT = 66,
  140. TCPLIVEPLAY_EXIT_LIBOPTS_FAILURE = 70
  141. } tcpliveplay_exit_code_t;
  142. /**
  143. * Interface defines for specific options.
  144. * @{
  145. */
  146. #define VALUE_OPT_DBUG 'd'
  147. #ifdef DEBUG
  148. #define OPT_VALUE_DBUG (DESC(DBUG).optArg.argInt)
  149. #endif /* DEBUG */
  150. #define VALUE_OPT_VERSION 'V'
  151. #define VALUE_OPT_LESS_HELP 'h'
  152. /** option flag (value) for help-value option */
  153. #define VALUE_OPT_HELP 'H'
  154. /** option flag (value) for more-help-value option */
  155. #define VALUE_OPT_MORE_HELP '!'
  156. /** option flag (value) for save-opts-value option */
  157. #define VALUE_OPT_SAVE_OPTS 0x1001
  158. /** option flag (value) for load-opts-value option */
  159. #define VALUE_OPT_LOAD_OPTS 0x1002
  160. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  161. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  162. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  163. DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
  164. /*
  165. * Interface defines not associated with particular options
  166. */
  167. #define ERRSKIP_OPTERR STMTS(tcpliveplayOptions.fOptSet &= ~OPTPROC_ERRSTOP)
  168. #define ERRSTOP_OPTERR STMTS(tcpliveplayOptions.fOptSet |= OPTPROC_ERRSTOP)
  169. #define RESTART_OPT(n) STMTS( \
  170. tcpliveplayOptions.curOptIdx = (n); \
  171. tcpliveplayOptions.pzCurOpt = NULL )
  172. #define START_OPT RESTART_OPT(1)
  173. #define USAGE(c) (*tcpliveplayOptions.pUsageProc)(&tcpliveplayOptions, c)
  174. #ifdef __cplusplus
  175. extern "C" {
  176. #endif
  177. /* * * * * *
  178. *
  179. * Declare the tcpliveplay option descriptor.
  180. */
  181. extern tOptions tcpliveplayOptions;
  182. #if defined(ENABLE_NLS)
  183. # ifndef _
  184. # include <stdio.h>
  185. # ifndef HAVE_GETTEXT
  186. extern char * gettext(char const *);
  187. # else
  188. # include <libintl.h>
  189. # endif
  190. # ifndef ATTRIBUTE_FORMAT_ARG
  191. # define ATTRIBUTE_FORMAT_ARG(_a)
  192. # endif
  193. static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
  194. static inline char* aoGetsText(char const* pz) {
  195. if (pz == NULL) return NULL;
  196. return (char*)gettext(pz);
  197. }
  198. # define _(s) aoGetsText(s)
  199. # endif /* _() */
  200. # define OPT_NO_XLAT_CFG_NAMES STMTS(tcpliveplayOptions.fOptSet |= \
  201. OPTPROC_NXLAT_OPT_CFG;)
  202. # define OPT_NO_XLAT_OPT_NAMES STMTS(tcpliveplayOptions.fOptSet |= \
  203. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  204. # define OPT_XLAT_CFG_NAMES STMTS(tcpliveplayOptions.fOptSet &= \
  205. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  206. # define OPT_XLAT_OPT_NAMES STMTS(tcpliveplayOptions.fOptSet &= \
  207. ~OPTPROC_NXLAT_OPT;)
  208. #else /* ENABLE_NLS */
  209. # define OPT_NO_XLAT_CFG_NAMES
  210. # define OPT_NO_XLAT_OPT_NAMES
  211. # define OPT_XLAT_CFG_NAMES
  212. # define OPT_XLAT_OPT_NAMES
  213. # ifndef _
  214. # define _(_s) _s
  215. # endif
  216. #endif /* ENABLE_NLS */
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220. #endif /* AUTOOPTS_TCPLIVEPLAY_OPTS_H_GUARD */
  221. /* tcpliveplay_opts.h ends here */