summaryrefslogtreecommitdiff
path: root/src/helper/command.c
Commit message (Collapse)AuthorAgeFilesLines
...
* factor script_command argv allocationZachary T Welch2009-11-201-27/+38
| | | | Splits argument allocation out from script command, reusing free() code.
* remove fast command and jim_global_longZachary T Welch2009-11-181-29/+0
| | | | | | | | Removing the fast command eliminates the fast_and_dangerous global, which was used only by arm7_9_common as an initializer. The command is not called in the tree; instead, more explicit commands are used. The jim_global_long function was not used anywhere in the tree.
* change all bool parsers to accept any valueZachary T Welch2009-11-181-3/+3
| | | | | | | | | This patch changes the behavior of all boolean parsing callers to accept any one of "true/enable/on/yes/1" or "false/disable/off/no/0". Since one particular pair will be most appropriate in any given situation, the specific macros should continue to be used in order to display the most informative error messages possible.
* add handle_command_parse_bool command helperZachary T Welch2009-11-181-0/+50
| | | | | | | | | Rewrite arm11_handle_bool to provide a generic on/off command helper. Refactors COMMAND_PARSE_BOOL to use new command_parse_bool helper, which gets reused by the new command_parse_bool_any helper. This later helper is called by the new command helper function to accepts any on/off, enable/disable, true/false, yes/no, or 0/1 parameter.
* pass startup_tcl to command_initZachary T Welch2009-11-181-2/+1
| | | | | Removes external linkage from helper module, making the startup code a parameter to a new command context's initialization routine.
* remove unused variable from run_commandZachary T Welch2009-11-171-3/+2
|
* add CMD_NAME variable in command_invocationZachary T Welch2009-11-171-7/+7
| | | | | Update CMD_NAME from its migratory home in CMD_ARGV[-1] to cmd->name. Allows CMD_ARGV++ idiom to be used safely in command handlers.
* add struct command_invocation for COMMAND_HANDLERZachary T Welch2009-11-171-3/+6
| | | | | | | | | | Adds the command_invocation structure to encapsulate parameters for all COMMAND_HANDLER routines. Rather than passing several arguments to each successive subroutine, a single pointer may be passed around. Changes the CMD_* macros to reference the new fields. Updates run_command to create an instance and pass it to the handler.
* command_handler: change 'args' to CMD_ARGVZachary T Welch2009-11-171-4/+4
| | | | | This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
* command_handler: change to 'argc' to CMD_ARGCZachary T Welch2009-11-171-3/+3
| | | | | This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
* use Jim_CmdProc in jim_registerZachary T Welch2009-11-161-1/+2
| | | | The jim_register command just needed to use the type defined by jim.h.
* 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