Ticket #306 (Fixed)Thu Aug 30 13:10:15 UTC 2012
CMHG's comments on *CONFIGURE handlers is wrong
Reported by: | Sprow (202) | Severity: | Minor |
Part: | RISC OS: C/C++ toolchain | Release: | |
Milestone: | Status | Fixed |
Details by Sprow (202):
The autogenerated header file from CMHG for command handlers is wrong, it states that if it’s a configure command then argc contains the number of arguments. It does not, confirmed by being baffled twice by this and having to look in the PRM then look in the kernel. Grr.
Changelog:
Modified by Ben Avison (25) Fri, August 31 2012 - 10:45:25 GMT
I spotted this myself when writing SDFS. It turns out argc is a pain to use even for normal star commands, because it’s counted according to OS_CLI’s rules. See the hoops I had to jump through to create a list of arguments that corresponded to argc:
http://www.riscosopen.org/viewer/view/cddl/Risc…
I’m actually quite tempted to modify cmhg to give authors an option to receive the arguments to the command handler in the same manner as main()‘s argc/argv so that all the above doesn’t need duplicating in every module.
Modified by Sprow (202) Mon, September 03 2012 - 22:16:32 GMT
Other modules get the same entry conditions because that’s whatever junk the kernel has left in that register (specifically for *CONFIGURE) so least effort is to ammend the comment block CMHG outputs.
Extra gold star for a new keyword “commands-pass-argc-argv:” hint in the CMHG file that prefixes some autogenerated parsing code too. In my case(s) I didn’t need this as the configure keyword had only 1 parameter so I just used strcmp().
Modified by Jeffrey Lee (213) Sun, November 02 2014 - 14:03:23 GMT
- Status changed from Open to Fixed
*Configure handler comments are now corrected as of cmhg 5.43 (DDE 25)