Invokes 'prefix' as a command with the objv array as arguments.
Note. Does not support embedded nulls in either the pattern or the object.
Apply the printf-like format in fmtObjPtr with the given arguments. Returns a new object with zero reference count if OK, or NULL on error.
Returns the length of the object string in chars, not bytes. These may be different for a utf-8 string.
Set the variable nameObjPtr to value valObjptr.
If nameObjPtr starts with "::", returns it. Otherwise returns a new object with nameObjPtr prefixed with "::". In this case, decrements the ref count of nameObjPtr.
match_type must be one of JIM_DICTMATCH_KEYS or JIM_DICTMATCH_VALUES return_types should be either or both
Must be called with at least one object. Returns the new dictionary, or NULL on error.
Sets a completion command to be used with Jim_HistoryGetline() If commandObj is NULL, deletes any existing completion command.
prints a nice 'unknown' parameter error message to the 'result'
Debug: convert argc/argv into a printable string for printf() debug Note, next call to this function will free the old (last) string. For example might want do this: \code fp = fopen("some.file.log", "a"); fprintf(fp, "PARAMS are: %s\n", Jim_DebugArgvString(interp, argc, argv)); fclose(fp); \endcode
GetOpt - how to. Example (short and incomplete): \code struct jim_getopt_info goi; jim_getopt_setup(&goi, interp, argc, argv); while (goi.argc) { e = jim_getopt_nvp(&goi, nvp_options, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(&goi, nvp_options, 0); return e; } switch (n->value) { case ALIVE: printf("Option ALIVE specified\n"); break; case FIRST: if (goi.argc < 1) { .. not enough args error .. } jim_getopt_string(&goi, &cp, NULL); printf("FIRSTNAME: %s\n", cp); case AGE: jim_getopt_wide(&goi, &w); printf("AGE: %d\n", (int)(w)); break; case POLITICS: e = jim_getopt_nvp(&goi, nvp_politics, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(&goi, nvp_politics, 1); return e; } } } \endcode Setup GETOPT \code struct jim_getopt_info goi; Jim_GetOptSetup(&goi, interp, argc, argv); \endcode
Remove argv[0] from the list.
A convenience version of Jim_CreateFileHandler() which evaluates scriptObj with Jim_EvalObjBackground() when the event occurs.
Looks up the appropriate subcommand in the given command table and return the command function which implements the subcommand. NULL will be returned and an appropriate error will be set if the subcommand or arguments are invalid. Typical usage is: { const jim_subcmd_type *ct = Jim_ParseSubCmd(interp, command_table, argc, argv); return Jim_CallSubCmd(interp, ct, argc, argv); }
Parses the args against the given command table and executes the subcommand if found or sets an appropriate error if the subcommand or arguments is invalid. Can be used directly with Jim_CreateCommand() where the ClientData is the command table. e.g. Jim_CreateCommand(interp, "mycmd", Jim_SubCmdProc, command_table, NULL);
Implements the common 'commands' subcommand
Invokes the given subcmd with the given args as returned by Jim_ParseSubCmd() If ct is NULL, returns JIM_ERR, leaving any message. Otherwise invokes ct->function If ct->function returns -1, sets an error message and returns JIM_ERR. Otherwise returns the result of ct->function.
Initialise the iterator at the start of the list.
For each key of the hash table 'ht' with object keys that matches the glob pattern (all if NULL), invoke the callback to add entries to a list. Returns the list.
Adds matching command names (procs, channels) to the list.
Adds matching variable names to the list.
Implements the [dict with] command
If the command is a proc, sets/updates the cached namespace (nsObj) based on the command name.
Expands the array variable (dict sugar) and returns the result, or NULL on error. If JIM_UNSHARED is set and the dictionary is shared, it will be duplicated and stored back to the variable before expansion.
If the name in objPtr is not fully qualified, and a non-global namespace is in effect, qualifies the name with the current namespace and returns the new name. Otherwise returns objPtr. In either case the ref count is incremented and should be decremented by the caller. with Jim_DecrRefCount()
Add the command to the commands hash table
Search for the given key in the dict hash table and perform the given operation. op_tvoffset is one of: DICT_HASH_FIND - if found, returns the table value offset, otherwise 0 DICT_HASH_REMOVE - if found, removes the entry and returns the table value offset, otherwise 0 DICT_HASH_ADD - if found, does nothing and returns the table value offset. otherwise adds the entry with a table value offset of dict->len + 1 and returns 0 A table value offset (> 0) - in this case the entry *must* exist and the table value offset for the entry is updated to be op_offset.
Add an entry to the hash table for 'keyObjPtr' If the entry already exists, returns the current tvoffset. Otherwise inserts a new entry with table value offset dict->len + 1 and returns 0.
Sets the interp result to be an error message indicating the required proc args.
Returns the parsed script. Note that if there is any possibility that the script is not valid, call JimScriptValid() to check
Note: does not support embedded nulls.
Note: does not support embedded nulls.
Note: does not support embedded nulls.
Creates a channel for fh/fd/filename. If fh is not NULL, uses that as the channel (and sets AIO_KEEPOPEN). Otherwise fd must be >= 0, in which case it uses that as the channel. hdlfmt is a sprintf format for the filehandle. Anything with %ld at the end will do. mode is used for open or fdopen. Creates the command and sets the name as the current result. Returns the AioFile pointer on sucess or NULL on failure (only if fdopen fails).
Create a pair of channels. e.g. from pipe() or socketpair()
Read from 'fd', append the data to strObj and close 'fd'. Returns 1 if data was added, 0 if not, or -1 on error.
Give a path in objPtr, returns a new path with any trailing slash removed. Use Jim_DecrRefCount() on the returned object (which may be identical to objPtr).
nsObj is a canonical namespace name (.e.g. "" for root, "abc" for ::abc) The given name is appended to the namespace name to produce a complete canonical name. e.g. "" "abc" => abc "" "::abc" => abc "" "abc::def" => abc::def "abc" "def" => abc::def "abc" "::def" => def
Returns the parent of the given namespace. ::bob::tom => ::bob bob::tom => bob ::bob => :: bob => "" :: => "" "" => ""
[pack] Usage: pack varname value -intbe|-intle|-floatle|-floatbe|-str width ?bitoffset? Packs the binary representation of 'value' into the variable of the given name. The value is packed according to the given type, width and bitoffset. The variable is created if necessary (like [append]) The variable is expanded if necessary
[unpack] Usage: unpack binvalue -intbe|-intle|-uintbe|-uintle|-floatbe|-floatle|-str bitpos bitwidth Unpacks bits from $binvalue at bit position $bitpos and with $bitwidth. Interprets the value according to the type and returns it.
Searches along a of paths for the given package. Returns the allocated path to the package file if found, or NULL if not found.