| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
|
|
|
| |
Delete obsolete jim that comes with OpenOCD.
|
|
|
|
|
|
|
| |
use obtuse local variable names in macros to avoid
interfering with global name space
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup
since it there was no command context defined for the jim interpreter
in that case.
A Jim interpreter is now associated with a command context(telnet,
gdb server's) or the default global command context.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
|
|
|
|
|
|
| |
COMMAND_REGISTER() was only used transiently during
code conversion.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
|
|
|
| |
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes from the flat namespace to heirarchical one. Instead of writing:
#include "types.h"
the following form should be used.
#include <helper/types.h>
The exception is from .c files in the same directory.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes from the flat namespace to heirarchical one. Instead of writing:
#include "jim.h"
the following form should be used.
#include <helper/jim.h>
The exception is from .c files in the same directory.
|
|
|
|
|
|
|
| |
In embedded hosts, the Jim interpreter can come from the
existing context rather than be created by OpenOCD.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
|
|
|
|
|
|
| |
Finish removing references to the 'interp' global variable from the
command module, encapsulating all reference via command_context.
Eliminates use of the global entirely, so it can be removed. Hurrah!
|
|
|
|
|
| |
Adds 'interp' field to command_context, chasing the few remaining
references to the global variable outside of the command module.
|
|
|
|
|
| |
Somehow, the comment block for command handlers ended up associated
with the output_handler. Move it to the command_handler_t declaration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
command_done() does not need to return an error, but it needed
Doxygen comment. Provide some for copy_command_context as well.
Note: this audit revealed some potential bugs with the command context
implementation. There was a reason that commands were added at the
end of the list. Shallow copying of command_context means that
the list is shared between them. And commands added at the top-level
before the pre-existing commands will not be available in the shared
context as they were before. Yikes!
Fortunately, this does not seem to occur in general use, as
'add_help_text' gets registered in startup.tcl and claims the first slot
in my own test cases. Thus, it seems that we have been masking the issue
for now, but it shows the need for further architectural improvement in
the core command module.
|
|
|
|
|
|
|
|
|
|
| |
Presently, commands registration taks a static handler data pointer.
This patch adds support for commands that require a dynamic pointer,
such as those registered in a dynamic context (e.g. subcommands for a
user-created 'foo.cpu' command). The command_set_handler_data will
update a command (group) to use a new context pointer, while the
CMD_DATA macro allows command handlers to access the value.
Jim handlers should find this value in interp->cmdPrivData.
|
|
|
|
|
|
| |
Adding jim_handler field to command_registration allows removing the
register_jim helper. All command registrations now go through the
register_command{,s}() functions.
|
|
|
|
|
| |
Allow other modules to find a command, primarily for the purpose of
registering and unregistering subcommands.
|
|
|
|
|
|
|
|
|
| |
Adds the ability to chain registration structures. Modules can define a
command with the 'chain' and 'num_chain' fields defined in their
registration table, and the register_commands() function will initialize
these commands. If the registration record creates a new command, then
the chained commands are created under it; otherwise, they are created
in the same context as the other commands (i.e. the parent argument).
|
|
|
|
|
|
| |
Adds the usage command, to display usage information for commands.
The output for this command will remain erronenously empty until
commands are updated to use these new coventions.
|
|
|
|
|
|
| |
The register_commands API takes multiple commands in one call, allowing
modules to declare and pass a much simpler (and more explicit) array of
command_registration records.
|
|
|
|
|
|
|
|
|
| |
Add a structure to encapsulate command registration information, rather
than passing them all as parameters. Enables further API changes that
require additional required or optional parameters.
Updates the register_command API and COMMAND_REGISTER macro to use it,
along with their documentation.
|
|
|
|
|
|
|
|
| |
Provides a migration path for the widely used register_command API,
which needs to be updated to provide new functionality.
This macro allows the API to change without having to update all of its
callers at the same time.
|
|
|
|
|
|
|
|
|
|
|
| |
Rewrites 'help' command in C, using new 'cmd_help' for display. Adds the
built-in 'help' COMMAND_HANDLER to provide better output than the
TCL-based script command (e.g. heirarchical listing of commands).
The help string is stored in the command structure, though it conitnues
to be pushed into the Jim environment. The current idiomatic usage
suggests the addition of a usage field as well, to provide two levels
of detail for users to consume (i.e. terse usage list, or verbose help).
|
|
|
|
|
|
|
|
|
| |
Refactors the command registration to use helpers to simplify the code.
The unregistration routines were made more flexible by allowing them
to operate on a single command, such that one can remove all of a
commands children in one step (perhaps before adding back a 'config'
subcommand that allows getting the others back). Eliminates a bit
of duplicated code and adds full API documentation for these routines.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds several macros similar to COMMAND_PARSE_NUMBER, but for parsing
boolean command arguments. Two flavors are provided to provide
drop-in compatibility with existing code, allow for the elimination
of a lot of code bloat while improving the error checking and reporting.
COMMAND_PARSE_ON_OFF parses "on"/"off" command parameters.
COMMAND_PARSE_ENABLE parses "enable"/"disable" command parameters.
Both print the error and return an error out of the calling function.
|
|
|
|
|
| |
Removes external linkage from helper module, making the startup
code a parameter to a new command context's initialization routine.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
|
|
|
|
|
|
|
|
|
| |
Add additional macros to allow command handling to be migrated easily:
CMD_CTX, CMD_ARGC, and CMD_ARGV. Updates CMD_NAME to use CMD_ARGV.
In addition to making the remaining patches of this series cleaner,
this introduces easily sed-able symbols that could allow us to retire
these once the command handler infrastructure matures (i.e. pre-1.0).
|
|
|
|
| |
The jim_register command just needed to use the type defined by jim.h.
|
|
|
|
| |
Remove misleading typedef and redundant suffix from struct command.
|
|
|
|
| |
Remove misleading typedef and redundant suffix from struct command_context.
|
|
|
|
|
| |
This patch removes 'cmd' from the list of direct parameters, moving
that pointer to args[-1] (by way of the new CMD_NAME macro).
|
|
|
|
|
| |
This patch prevents command handlers from modifying the strings passed
in the 'args' array.
|
|
|
|
|
| |
Prevents the command name from being modified in command handlers.
Again, this has cascading effects, but the patches are fairly minimal.
|
|
|
|
|
|
| |
The number of command arguments will always be 0 or more, so use
the right type in handlers. This has a cascading effect up through
the layers, but the new COMMAND_HANDLER macros prevented total chaos.
|
|
|
|
|
| |
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The COMMAND_HANDLER and COMMAND_HELPER macros allow commands to be
defined in a manner that decouples them from the exact order and type of
their parameters. Once converted, incremental changes to the command
handler type can be addressed in incremental patches that do not need to
touch the entire tree.
These macros' implementation, __COMMAND_HANDLER, is used to define the
new command_handler_t type, and additional patches will use it to derive
new macros to define extended command types (e.g. flash, nand, pld).
The CALL_COMMAND_HANDLER provides a means of calling helpers or nested
handlers from withing a command handler.
This patch uses C99 varadic macro expansion. Please report compilers
that cannot handle this code.
|
|
|
|
|
| |
Add a typedef for command output handler function type, simplifying
the appearance of functions that use it and eliminating duplicate code.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Use unsigned type for number of arguments.
|
|
|
|
|
| |
Remove all useless 'extern' keywords from function prototypes.
Wraps long lines for readability.
|
|
|
|
|
|
|
|
| |
This helper eliminates significant amount of redundant code in command
handler functions throughout the system. It wraps the lower-level
parse_* macros to implement a policy for reporting parse errors to the
active command context (cmd_ctx). If errors do occur, this macro causes
the calling function to abort with the proper return code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Compilation on cygwin, using gcc v3 with option -mno-cygwin,
currently produces a large number of the following warnings:
warning: `gnu_printf' is an unrecognized format function type
These have been introduced with the recent MinGW GNU C99 printf
compliance patch, as gnu_printf was only introduced with gcc v4.4
and is not recognized with earlier versions.
The attached fix adds gcc version detection to the previous patch
to avoid the problem.
|
|
|
|
|
|
|
|
| |
Passing "--std=gun99" is unfortunately not sufficient to make current
MinGW compilers conform with respect to checking printf format strings.
(The C runtime seems not to have problems.)
Fix by using a "gnu_printf" format specifier not "printf".
|
|
|
|
| |
git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
|