[asterisk-commits] kpfleming: trunk r100305 - /trunk/include/asterisk/app.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 24 16:26:04 CST 2008


Author: kpfleming
Date: Thu Jan 24 16:26:04 2008
New Revision: 100305

URL: http://svn.digium.com/view/asterisk?view=rev&rev=100305
Log:
add the ability to define a structure type for argument parsing when it would be useful to be able to pass it between functions

Modified:
    trunk/include/asterisk/app.h

Change Statistics:
 0 files changed

Modified: trunk/include/asterisk/app.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/app.h?view=diff&rev=100305&r1=100304&r2=100305
==============================================================================
--- trunk/include/asterisk/app.h (original)
+++ trunk/include/asterisk/app.h Thu Jan 24 16:26:04 2008
@@ -267,11 +267,11 @@
 #define AST_APP_ARG(name) char *name
 
 /*!
-  \brief Declare a structure to hold the application's arguments.
+  \brief Declare a structure to hold an application's arguments.
   \param name The name of the structure
   \param arglist The list of arguments, defined using AST_APP_ARG
 
-  This macro defines a structure intended to be used in a call
+  This macro declares a structure intended to be used in a call
   to ast_app_separate_args(). The structure includes all the
   arguments specified, plus an argv array that overlays them and an
   argc argument counter. The arguments must be declared using AST_APP_ARG,
@@ -281,12 +281,28 @@
   ast_app_separate_args() will perform that function before parsing
   the arguments.
  */
-#define AST_DECLARE_APP_ARGS(name, arglist) \
+#define AST_DECLARE_APP_ARGS(name, arglist) AST_DEFINE_APP_ARGS_TYPE(, arglist) name
+
+/*!
+  \brief Define a structure type to hold an application's arguments.
+  \param type The name of the structure type
+  \param arglist The list of arguments, defined using AST_APP_ARG
+
+  This macro defines a structure type intended to be used in a call
+  to ast_app_separate_args(). The structure includes all the
+  arguments specified, plus an argv array that overlays them and an
+  argc argument counter. The arguments must be declared using AST_APP_ARG,
+  and they will all be character pointers (strings).
+
+  \note This defines a structure type, but does not declare an instance
+  of the structure. That must be done separately.
+ */
+#define AST_DEFINE_APP_ARGS_TYPE(type, arglist) \
 	struct { \
 		unsigned int argc; \
 		char *argv[0]; \
 		arglist \
-	} name
+	}
 
 /*!
   \brief Performs the 'standard' argument separation process for an application.




More information about the asterisk-commits mailing list