tcpliveplay_opts.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 tcpliveplay_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 41:1:16 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. /**
  63. * Ensure that the library used for compiling this generated header is at
  64. * least as new as the version current when the header template was released
  65. * (not counting patch version increments). Also ensure that the oldest
  66. * tolerable version is at least as old as what was current when the header
  67. * template was released.
  68. */
  69. #define AO_TEMPLATE_VERSION 167937
  70. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  71. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  72. # error option template version mismatches autoopts/options.h header
  73. Choke Me.
  74. #endif
  75. /**
  76. * Enumeration of each option type for tcpliveplay
  77. */
  78. typedef enum {
  79. INDEX_OPT_DBUG = 0,
  80. INDEX_OPT_VERSION = 1,
  81. INDEX_OPT_LESS_HELP = 2,
  82. INDEX_OPT_HELP = 3,
  83. INDEX_OPT_MORE_HELP = 4,
  84. INDEX_OPT_SAVE_OPTS = 5,
  85. INDEX_OPT_LOAD_OPTS = 6
  86. } teOptIndex;
  87. /** count of all options for tcpliveplay */
  88. #define OPTION_CT 7
  89. /**
  90. * Interface defines for all options. Replace "n" with the UPPER_CASED
  91. * option name (as in the teOptIndex enumeration above).
  92. * e.g. HAVE_OPT(DBUG)
  93. */
  94. #define DESC(n) (tcpliveplayOptions.pOptDesc[INDEX_OPT_## n])
  95. /** 'true' if an option has been specified in any way */
  96. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  97. /** The string argument to an option. The argument type must be \"string\". */
  98. #define OPT_ARG(n) (DESC(n).optArg.argString)
  99. /** Mask the option state revealing how an option was specified.
  100. * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
  101. * \a OPTST_DEFINED, \a OPTST_RESET or zero.
  102. */
  103. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  104. /** Count of option's occurrances *on the command line*. */
  105. #define COUNT_OPT(n) (DESC(n).optOccCt)
  106. /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
  107. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  108. /** 'true' if \a HAVE_OPT would yield 'false'. */
  109. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  110. /** 'true' if OPTST_DISABLED bit not set. */
  111. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  112. /** number of stacked option arguments.
  113. * Valid only for stacked option arguments. */
  114. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  115. /** stacked argument vector.
  116. * Valid only for stacked option arguments. */
  117. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  118. /** Reset an option. */
  119. #define CLEAR_OPT(n) STMTS( \
  120. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  121. if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  122. DESC(n).fOptState |= OPTST_DISABLED; \
  123. DESC(n).optCookie = NULL )
  124. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  125. /**
  126. * Enumeration of tcpliveplay exit codes
  127. */
  128. typedef enum {
  129. TCPLIVEPLAY_EXIT_SUCCESS = 0,
  130. TCPLIVEPLAY_EXIT_FAILURE = 1,
  131. TCPLIVEPLAY_EXIT_USAGE_ERROR = 64,
  132. TCPLIVEPLAY_EXIT_NO_CONFIG_INPUT = 66,
  133. TCPLIVEPLAY_EXIT_LIBOPTS_FAILURE = 70
  134. } tcpliveplay_exit_code_t;
  135. /**
  136. * Interface defines for specific options.
  137. * @{
  138. */
  139. #define VALUE_OPT_DBUG 'd'
  140. #ifdef DEBUG
  141. #define OPT_VALUE_DBUG (DESC(DBUG).optArg.argInt)
  142. #endif /* DEBUG */
  143. #define VALUE_OPT_VERSION 'V'
  144. #define VALUE_OPT_LESS_HELP 'h'
  145. /** option flag (value) for help-value option */
  146. #define VALUE_OPT_HELP 'H'
  147. /** option flag (value) for more-help-value option */
  148. #define VALUE_OPT_MORE_HELP '!'
  149. /** option flag (value) for save-opts-value option */
  150. #define VALUE_OPT_SAVE_OPTS 0x1001
  151. /** option flag (value) for load-opts-value option */
  152. #define VALUE_OPT_LOAD_OPTS 0x1002
  153. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  154. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  155. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  156. DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
  157. /*
  158. * Interface defines not associated with particular options
  159. */
  160. #define ERRSKIP_OPTERR STMTS(tcpliveplayOptions.fOptSet &= ~OPTPROC_ERRSTOP)
  161. #define ERRSTOP_OPTERR STMTS(tcpliveplayOptions.fOptSet |= OPTPROC_ERRSTOP)
  162. #define RESTART_OPT(n) STMTS( \
  163. tcpliveplayOptions.curOptIdx = (n); \
  164. tcpliveplayOptions.pzCurOpt = NULL )
  165. #define START_OPT RESTART_OPT(1)
  166. #define USAGE(c) (*tcpliveplayOptions.pUsageProc)(&tcpliveplayOptions, c)
  167. #ifdef __cplusplus
  168. extern "C" {
  169. #endif
  170. /* * * * * *
  171. *
  172. * Declare the tcpliveplay option descriptor.
  173. */
  174. extern tOptions tcpliveplayOptions;
  175. #if defined(ENABLE_NLS)
  176. # ifndef _
  177. # include <stdio.h>
  178. # ifndef HAVE_GETTEXT
  179. extern char * gettext(char const *);
  180. # else
  181. # include <libintl.h>
  182. # endif
  183. # ifndef ATTRIBUTE_FORMAT_ARG
  184. # define ATTRIBUTE_FORMAT_ARG(_a)
  185. # endif
  186. static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
  187. static inline char* aoGetsText(char const* pz) {
  188. if (pz == NULL) return NULL;
  189. return (char*)gettext(pz);
  190. }
  191. # define _(s) aoGetsText(s)
  192. # endif /* _() */
  193. # define OPT_NO_XLAT_CFG_NAMES STMTS(tcpliveplayOptions.fOptSet |= \
  194. OPTPROC_NXLAT_OPT_CFG;)
  195. # define OPT_NO_XLAT_OPT_NAMES STMTS(tcpliveplayOptions.fOptSet |= \
  196. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  197. # define OPT_XLAT_CFG_NAMES STMTS(tcpliveplayOptions.fOptSet &= \
  198. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  199. # define OPT_XLAT_OPT_NAMES STMTS(tcpliveplayOptions.fOptSet &= \
  200. ~OPTPROC_NXLAT_OPT;)
  201. #else /* ENABLE_NLS */
  202. # define OPT_NO_XLAT_CFG_NAMES
  203. # define OPT_NO_XLAT_OPT_NAMES
  204. # define OPT_XLAT_CFG_NAMES
  205. # define OPT_XLAT_OPT_NAMES
  206. # ifndef _
  207. # define _(_s) _s
  208. # endif
  209. #endif /* ENABLE_NLS */
  210. #ifdef __cplusplus
  211. }
  212. #endif
  213. #endif /* AUTOOPTS_TCPLIVEPLAY_OPTS_H_GUARD */
  214. /* tcpliveplay_opts.h ends here */