Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 56063 invoked from network); 5 Sep 2005 21:47:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2005 21:47:26 -0000 Received: (qmail 24073 invoked by uid 500); 5 Sep 2005 21:47:26 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 24057 invoked by uid 500); 5 Sep 2005 21:47:25 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 24044 invoked by uid 500); 5 Sep 2005 21:47:25 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 24041 invoked by uid 99); 5 Sep 2005 21:47:25 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 05 Sep 2005 14:47:25 -0700 Received: (qmail 56057 invoked by uid 65534); 5 Sep 2005 21:47:25 -0000 Message-ID: <20050905214725.56056.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r278860 - /incubator/stdcxx/trunk/tests/include/cmdopt.h Date: Mon, 05 Sep 2005 21:47:24 -0000 To: stdcxx-cvs@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Mon Sep 5 14:47:23 2005 New Revision: 278860 URL: http://svn.apache.org/viewcvs?rev=278860&view=rev Log: 2005-09-05 Martin Sebor * cmdopt.h: Added documentation. Modified: incubator/stdcxx/trunk/tests/include/cmdopt.h Modified: incubator/stdcxx/trunk/tests/include/cmdopt.h URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/cmdopt.h?rev=278860&r1=278859&r2=278860&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/include/cmdopt.h (original) +++ incubator/stdcxx/trunk/tests/include/cmdopt.h Mon Sep 5 14:47:23 2005 @@ -1,5 +1,8 @@ /*************************************************************************** * + * cmdopt.h - declarations of helper functions for the processing + * of command line options + * * $Id$ * ************************************************************************ @@ -17,28 +20,118 @@ * **************************************************************************/ -#ifndef CMDOPT_H_INCLUDED -#define CMDOPT_H_INCLUDED +#ifndef RW_CMDOPT_H_INCLUDED +#define RW_CMDOPT_H_INCLUDED -#include // for libstd config macros #include // for test config macros +/** + * Appends a set of command line options and their handlers to the global + * list of command line option handlers for the current process. + * + * @param optspec A string of command line option specifiers describing + * the names and parameters of the command line options and their + * handlers. The string has the following syntax: + * + * ::= [ ':' | '=' | '#' ] + * [ @N | @* | '!' ] + * [ ] + * ::= [ '|' ] + * ::= '|' + * ::= char + * ::= '-' char char* + * ::= 'A' - 'Z', 'a'-'z', '0' - '9', '_' + * + * Each command line option may have a short name, a long name, + * or both. When referenced (either on the command line or in + * the environment), the name of command line option is + * introduced by a hyphen ('-'). + * + * A short option name () consits of a single alphanumeric + * character or an underscore ('_'). + * + * A long name () starts with a hyphen ('-') followed by + * one or more aphanumeric characters or underscores. + * + * The name of the command line option is followd by one or more + * special characters with the following meaning: + * + * ':' the option takes an optional argument + * '=' the option takes a required argument that must immediately + * follow the equals sign + * '#' the handler for this option is not a function but rather + * a pointer to an signed integer that rw_runopts() sets to + * a non-zero value if the option appears on the command line + * @N the option handler will be invoked for the first N + * occurrences of the option name on the command line + * @* the option handler will be invoked for every occurrence + * of the option name on the command line + * ! the option handler will be invoked only if the option name + * does not appear on the command line + * + * @param ... A list of zero or more command line option handlers whose + * type is either int (*)(int, char**) or int*, the latter + * corresponding to options denoted with the '#' special character. + * + * @return On success, returns the number of command line options + * currently defined for the process, negative value on error. + */ _TEST_EXPORT int -rw_setopts (const char*, ...); +rw_setopts (const char *optspec, ...); + +/** + * Processes the set of command line options and arguments specified by + * the function arguments (usually the same arguments as those passed to + * main()). + * + * @param argc The number of non-zero elements of the argv vector. + * @param argv An array of pointers to command line options and arguments + * whose the last element, argv [argc], has the value 0. + * + * @return Returns the status of last evaluated command line option handler. + */ _TEST_EXPORT int -rw_runopts (int, char*[]); +rw_runopts (int argc, char *argv[]); + +/** + * Processes the set of command line options and arguments specified by + * the function argument (usually the value of an environment variable). + * + * @param argvstr A character string of command line options and arguments + * separated by one or more spaces. + * + * @return Returns the status of last evaluated command line option handler. + */ _TEST_EXPORT int -rw_runopts (const char*); +rw_runopts (const char *argvstr); + +/** + * Determines whether a feature is enabled. + * + * @param name The name of a feature. + * + * @return Returns a non-zero value if the named feature is enabled, + * otherwise 0. + */ _TEST_EXPORT int -rw_enabled (const char*); +rw_enabled (const char *name); + +/** + * Determines whether a case (or line) is enabled. + * + * @param name The case (or line) number + * + * @return Returns a non-zero value if the case (line) is enabled, + * otherwise 0. + */ _TEST_EXPORT int -rw_enabled (int); +rw_enabled (int line); -#endif // CMDOPT_H_INCLUDED +#endif // RW_CMDOPT_H_INCLUDED