Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why doesn AutoOpts handle floating point option arguments?

autoopts floating option point
0
Posted

Why doesn AutoOpts handle floating point option arguments?

0

Because handling it yourself is trivial, handling it in a fully integrated fashion is hard and I don’t use floating point myself. That’s the short answer. Here are the details for the first two parts: • Write your own callback routine. flag = { name = something; value = s; arg-type = string; arg-name = float; descrip = “floating point argument”; doc = “Example of an option with a floating point arg.”; flag-code = <<- EOF extern double val; sscanf( pOptDesc->pzLastArg, “%f”, &val ); if (validations_fail) { fprintf( stderr, “bad float for ‘something’\n” ); USAGE( EXIT_FAILURE ); } EOF ; }; • Provide a patch to extend the arg-type handling. 🙂 You would probably need to fiddle with the various opt*.tpl files and the documentation templates (agman1.tpl and aginfo.tpl) and you would need to add a bit flag to the option descriptor flag bits and worry about how to save the data (save.c) and even how to keep the data (since floating point numbers do not fit in void*/char* buckets). This would

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123