summaryrefslogtreecommitdiff
path: root/src/helper/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command_t -> struct commandZachary T Welch2009-11-131-17/+17
| | | | Remove misleading typedef and redundant suffix from struct command.
* command_context_t -> struct command_contextZachary T Welch2009-11-131-20/+20
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* command_handler_t: make cmd an indirect parameterZachary T Welch2009-11-131-7/+9
| | | | | This patch removes 'cmd' from the list of direct parameters, moving that pointer to args[-1] (by way of the new CMD_NAME macro).
* command_handler_t: make args parameter constZachary T Welch2009-11-131-4/+6
| | | | | This patch prevents command handlers from modifying the strings passed in the 'args' array.
* use COMMAND_HANDLER macro to define all commandsZachary T Welch2009-11-131-3/+2
|
* add command_handler_t typeZachary T Welch2009-11-131-3/+1
| | | | | | This patch adds new typedefs for command handler callback functions. Users of this type signature were updated to use these new types. It uses the new __COMMAND_HANDLER macro to prevent duplication.
* add command_output_handler_tZachary T Welch2009-11-131-1/+2
| | | | | Add a typedef for command output handler function type, simplifying the appearance of functions that use it and eliminating duplicate code.
* improve command registrationZachary T Welch2009-11-111-31/+43
| | | | | | | Eliminate duplicate code for linking commands into a list. Adds a check to ensure the command does not already exist; if it does, return that one instead of creating a duplicate.
* add help regardless of callbackZachary T Welch2009-11-111-2/+2
| | | | | | | | | Add help for commands regardless of whether a handler is involved. With this, all sorts of new commands can be found in 'help' text. Hopefully, all of them have been documented.... Sadly, the lsort function appears to handle nested lists poorly, such that sub-commands do not group with their parents.
* eliminate duplicate helptext managementZachary T Welch2009-11-111-31/+30
| | | | | Add helpers to manage adding entries to the helptext list. Adds support for arbitrarily nested commands.
* add command_name helperZachary T Welch2009-11-111-32/+39
| | | | | | | The command_name function returns a malloced string for a given command and its parents. This can be used to display a message to the user, but it is used internally to handle registration and syntax errors. This helps permit arbitrary command nesting.
* script_debug(): improve typesZachary T Welch2009-11-111-4/+4
| | | | Use unsigned type for number of arguments.
* command.c: make private routines staticZachary T Welch2009-11-111-2/+4
| | | | This patch also improves the signature of run_command function.
* log: improve log_callback_fn signatureZachary T Welch2009-11-111-2/+2
| | | | Use unsigned type for line number in log_callback_fn signature.
* tcl: HostOs now picks up eCos as well during compile timeØyvind Harboe2009-11-101-0/+2
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* command.c: make commands staticZachary T Welch2009-11-091-50/+48
| | | | | Removes useless declarations, moving the handler functions to appear before their use in the (much bigger) command registriation function.
* User's Guide: bugfix global state infoDavid Brownell2009-11-091-8/+13
| | | | | | | | | The "$ocd_HOSTOS" variable was wrongly documented. Fix its documentation, and its value on Linux. Shrink a few of the too-long lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* David Brownell <david-b@pacbell.net> Be sure the built-in search paths ↵oharboe2009-08-301-2/+0
| | | | | | | | | | | | always go *after* ones provided on the command line ... matching comment in add_default_dirs(). Without this it's impossible to use a private config file which happens to have the same name as an installed one. Say, because you're bugfixing a private copy... git-svn-id: svn://svn.berlios.de/openocd/trunk@2649 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Steve Grubb <sgrubb@redhat.com> fix various and sundry leaksoharboe2009-08-241-0/+4
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2606 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixesoharboe2009-07-171-1/+1
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* try to use tabs instead of spacesoharboe2009-07-061-3/+3
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2465 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* human readable error message upon invalid argumentsoharboe2009-07-061-1/+13
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2464 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Remove whitespace at end of lines, step 2.zwelch2009-06-231-1/+1
| | | | | | | - Replace '\s*$' with ''. git-svn-id: svn://svn.berlios.de/openocd/trunk@2380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Replace '){' with ') {'.zwelch2009-06-231-1/+1
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Remove whitespace that occurs before ')'.zwelch2009-06-231-11/+11
| | | | | | | - Replace '[ \t]*[)]' with ')'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Remove whitespace that occurs after '('.zwelch2009-06-231-8/+8
| | | | | | | - Replace '([ \t]*' with '('. git-svn-id: svn://svn.berlios.de/openocd/trunk@2376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '[<>]' whitespacezwelch2009-06-231-1/+1
| | | | | | | | | | - Replace ')\([<>]\)(' with ') \1 ('. - Replace ')\([<>]\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\([<>]\)(' with '\1 \2 ('. - Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2375 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '[|]' whitespacezwelch2009-06-231-1/+1
| | | | | | | | | | - Replace ')\([|]\)(' with ') \1 ('. - Replace ')\([|]\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\([|]\)(' with '\1 \2 ('. - Replace '\(\w\)\([|]\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2374 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '+' whitespacezwelch2009-06-231-3/+3
| | | | | | | | | | - Replace ')\(+\)(' with ') \1 ('. - Replace ')\(+\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(+\)(' with '\1 \2 ('. - Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2373 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '=' whitespacezwelch2009-06-231-20/+20
| | | | | | | | | - Replace ')\(=\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(=\)(' with '\1 \2 ('. - Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2372 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '==' whitespacezwelch2009-06-231-8/+8
| | | | | | | | - Replace ')\(==\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Fixes '!=' whitespacezwelch2009-06-231-6/+6
| | | | | | | | | - Replace ')\(!=\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(!=\)(' with '\1 \2 ('. - Replace '\(\w\)\(!=\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Replace 'while(' with 'while ('.zwelch2009-06-231-4/+4
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2358 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* - Replace 'if(' with 'if ('.zwelch2009-06-231-1/+1
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Ensure range errors are reported only when errno indicates one occurred.zwelch2009-06-171-2/+2
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2260 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Change parse_type macros to be sed-friendly.zwelch2009-06-171-9/+9
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2259 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Add argument parsing errors in command.h, use in parse_type routines.zwelch2009-06-171-6/+8
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2258 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Move definition of parse_type helpers to command.c:zwelch2009-06-171-0/+29
| | | | | | | | - Add declarations in header file. - Improve wrapper implementations to check for underflow. git-svn-id: svn://svn.berlios.de/openocd/trunk@2257 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Convert core parse_type implementations to check for underflow errors.zwelch2009-06-171-8/+12
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2256 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Add improved support for parsing signed integers.zwelch2009-06-171-0/+2
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@2255 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Improve definitions of parse_ulong and parse_ullong:zwelch2009-06-171-14/+11
| | | | | | | | - Use macro to eliminate duplicate body definitions. - Rename okay as is_okay; add parenthesis to help "clarify" logic. git-svn-id: svn://svn.berlios.de/openocd/trunk@2253 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* David Brownell <david-b@pacbell.net>:zwelch2009-06-121-2/+18
| | | | | | | | | | | | | Currently the "debug_level 3" command tracing ignores commands that could return values to TCL scripts (by plugging in to a slightly lower level of the interpreter stack). Fix that by abstracting the tracing command and starting to make some of those previously-untraced commands use this new mechanism. git-svn-id: svn://svn.berlios.de/openocd/trunk@2224 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Simplify handle_sleep_command:zwelch2009-06-121-20/+18
| | | | | | | | | - Use new parse_ulong to ensure duration parses as a valid number. - Rework logic to improve readability and seliminate uperfluous braces. - Change whitespace to improve style. git-svn-id: svn://svn.berlios.de/openocd/trunk@2207 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Add new parse_uinttype wrappers for strtoul in src/helper/command.[ch].zwelch2009-06-121-0/+15
| | | | | | | - Used to improve command argument parsing of unsigned integers values. git-svn-id: svn://svn.berlios.de/openocd/trunk@2206 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* David Brownell <david-b@pacbell.net>:zwelch2009-06-111-3/+3
| | | | | | | | | | Minor bugfix: command_print_sameline() is what the headers declare; make the code match. Minor improvement: make the printf format params always be const. git-svn-id: svn://svn.berlios.de/openocd/trunk@2205 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* David Brownell <david-b@pacbell.net>:zwelch2009-05-241-1/+1
| | | | | | | | | The "Illegal mode for command" diagnostic is deeply useless. Say "Command '%s' only runs during configuration stage" instead, letting users know what the real issue is. git-svn-id: svn://svn.berlios.de/openocd/trunk@1908 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Remove unecessary(and poptentially harmful?) "" around argumentsoharboe2009-05-181-1/+1
| | | | | | | passed in to "eval" in command.c git-svn-id: svn://svn.berlios.de/openocd/trunk@1811 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Less wrong handling of JIM_EMBEDDED, follow Jim Tcl doc's and only use ↵oharboe2009-05-151-3/+8
| | | | | | JIM_EMBEDDED in a single .c file. Still broken w/-fno-common(i.e. Mac OS). git-svn-id: svn://svn.berlios.de/openocd/trunk@1794 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* Audit and eliminate redundant helper #include directives.zwelch2009-05-111-9/+1
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@1706 b42882b7-edfa-0310-969c-e2dbd0fdcd60
* remove extra newline before promptoharboe2009-05-051-12/+15
| | | | git-svn-id: svn://svn.berlios.de/openocd/trunk@1605 b42882b7-edfa-0310-969c-e2dbd0fdcd60