[MINC-development] MINC 2.0 -- ParseArgv

Robert VINCENT minc-development@bic.mni.mcgill.ca
Thu, 26 Jun 2003 11:24:21 -0400


Andrew,

The "new" MINC will continue to include the "old" libminc, which will be
supported indefinitely.  We probably should've been clearer about that.
So ParseArgv isn't going anywhere.

As to your suggested extension, I'm all for it, but I'd like to keep it
backward-compatible if possible, and to make it work with one or
more floating point or integer arguments:

    {"-arb_path_coord_buffer", ARGV_INT, (char *)1, (char *)&ap_buff_size,
     "Size of arbitrary path co-ordinate buffer"},

would become this:

    {"-arb_path_coord_buffer", ARGV_INT_RNGCHK, (char *)&rng_buf,
     (char *)&ap_buff_size, "Size of arbitrary path co-ordinate buffer"},

Where rng_buf is defined as:

struct ArgvRangeInfo {
	int nargs;
	struct {
		double min;
		double max;
	} ranges[MI_MAX_RANGE_ARGS];
} rng_buf = {
	1,
	{ 0.0, 50000.0 }
};

MI_MAX_RANGE_ARGS would be some large number (100 or so?), so that the
structure doesn't have to be dynamically defined.  If you don't like an
arbitrary upper limit on the number of arguments that can be
range-checked, we could probably come up with something more dynamic but
more complicated.

If min == max, no range checking would be performed on the corresponding
argument.

Any reaction?  Is this overkill?

	-bert

On Tue, 24 Jun 2003, Andrew Janke wrote:

>
> Are there plans to include ParseArgv in the "new" MINC?  Reason I ask is that if
> anyone is feeling energetic I wouldn't mind range checking being included..
>
> ie: a line in an arg table that used to look like this:
>
>    {"-arb_path_coord_buffer", ARGV_INT, (char *)1, (char *)&ap_buff_size,
>     "Size of arbitrary path co-ordinate buffer"},
>
> would now look like this:
>
>    {"-arb_path_coord_buffer", ARGV_INT, (char *)1, 0, 50000,
>     (char *)&ap_buff_size, "Size of arbitrary path co-ordinate buffer"},
>
> And would check that the input int is between 0 and 50000. obviously NULL could
> be used to signify that no checking is required.
>
>
> a
> _______________________________________________
> MINC-development mailing list
> MINC-development@bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
>