diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-12-12 10:43:33 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2013-12-21 01:56:58 +1000 |
commit | 5390d57487b0bc2cd6ff736f50e0acbbdb6c03e7 (patch) | |
tree | 79c84a1accd358ca851081c76e5c7b3b3b12dda8 /jim-array.c | |
parent | d30e9aabf9e5e1956f25a3f74f61d26075a39c46 (diff) | |
download | jimtcl-5390d57487b0bc2cd6ff736f50e0acbbdb6c03e7.zip jimtcl-5390d57487b0bc2cd6ff736f50e0acbbdb6c03e7.tar.gz jimtcl-5390d57487b0bc2cd6ff736f50e0acbbdb6c03e7.tar.bz2 |
Implement more dict sub commands
dict for, values, incr, append, lappend, update, replace and info
Also implement array stat (the same as dict info)
Note that [dict info] and [array stat] are for useful for checking
the behaviour of the hash randomiser
Add Jim_EvalEnsemble()
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-array.c')
-rw-r--r-- | jim-array.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/jim-array.c b/jim-array.c index f364ec8..d4f9449 100644 --- a/jim-array.c +++ b/jim-array.c @@ -151,6 +151,16 @@ static int array_cmd_size(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } +static int array_cmd_stat(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_Obj *objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); + if (objPtr) { + return Jim_DictInfo(interp, objPtr); + } + Jim_SetResultFormatted(interp, "\"%#s\" isn't an array", argv[0], NULL); + return JIM_ERR; +} + static int array_cmd_set(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; @@ -222,6 +232,13 @@ static const jim_subcmd_type array_command_table[] = { 1, /* Description: Number of elements in array */ }, + { "stat", + "arrayName", + array_cmd_stat, + 1, + 1, + /* Description: Print statistics about an array */ + }, { "unset", "arrayName ?pattern?", array_cmd_unset, |