From: <li...@mi...> - 2007-10-02 18:07:09
|
Hi Mike, presently the only integer type genparse can handle is int. I suggest to add a new command line switch -g / --gnulib which allows to use the GNU Compatibility Library (Gnulib, see http://www.gnu.org/software/gnulib/). If this switch is set then Genparse will support the following types: long int unsigned long int intmax_t (which is defined as long long int in Gnulib) uintmax_t (which is defined as unsigned long long int in Gnulib) double Gnulib provides conversion functions for all these types. Here's an example Genparse file (for the tail command of the GNU Coreutils): NONE / pid=PID ulong [...PID_T_MAX] 0 "with -f, terminate after process ID, PID dies" __ERR_MSG__("%s: invalid PID") And this is the generated code: case 258: if (xstrtoul (optarg, NULL, 10, &my_args->pid, NULL) != LONGINT_OK || my_args->pid > PID_T_MAX) error (EXIT_FAILURE, 0, _("%s: invalid PID"), optarg); break; error () is also defined in Gnulib. Michael |