#include "temu-c/Support/Attributes.h"
#include "temu-c/Support/Objsys.h"
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
TEMU_API int | temu_parseCommandLineOptions (int argc, const char *argv[]) |
|
TEMU_API void | temu_printCommandLineHelp (void) |
|
TEMU_API int | temu_execCommandFile (const char *File) |
|
TEMU_API int | temu_execCommand (const char *Cmd) |
|
TEMU_API void * | temu_createClassCmd (temu_Class *Cls, const char *Name, const char *Doc, temu_ObjectCommandFunc F) |
|
TEMU_API void * | temu_classGetCmd (temu_Class *Cls, const char *Name) |
|
TEMU_API int | temu_classCmdAddParam (void *Cmd, const char *Name, temu_CmdOptionKind Type, int Required, const char *Doc) |
|
TEMU_API int | temu_objectInvokeCmd (temu_Object *Obj, void *I, const char *Name, int Argc, temu_CmdArg Argv[]) |
|
TEMU_API int | temu_raiseCmdError (void *I, const char *S,...) |
|
TEMU_API void * | temu_createCmd (const char *Name, temu_CommandFunc F, const char *Doc, void *Data) |
|
TEMU_API void | temu_cmdAddOption (void *Cmd, const char *OptName, temu_CmdOptionKind Type, int Required, const char *Doc, const char *Default) |
|
TEMU_API void * | temu_cmdGetData (void *Ctxt) |
|
TEMU_API void * | temu_cmdGetInterpreter (void *Ctxt) |
|
TEMU_API int64_t | temu_cmdGetOptionAsInteger (void *Ctxt, const char *OptName) |
|
TEMU_API void * | temu_cmdGetOptionAsObject (void *Ctxt, const char *OptName) |
|
TEMU_API const char * | temu_cmdGetOptionAsString (void *Ctxt, const char *OptName) |
|
TEMU_API double | temu_cmdGetOptionAsReal (void *Ctxt, const char *OptName) |
|
TEMU_API size_t | temu_cmdGetPosOptSize (void *Ctxt) |
|
TEMU_API const char * | temu_cmdGetPosOpt (void *Ctxt, size_t Idx) |
|
TEMU_API int | temu_cmdOptionIsValid (void *Ctxt, const char *OptName) |
|
TEMU_API int | temu_cmdSetVariable (const char *Key, const char *Value) |
|
TEMU_API const char * | temu_cmdGetVariable (const char *Key) |
|
◆ temu_CmdOptionKind
◆ temu_CommandFunc
typedef int(* temu_CommandFunc) (void *) |
◆ temu_ObjectCommandFunc
◆ temu_CmdOptionKind
Enumerator |
---|
teCOK_String | |
teCOK_Path | Path is a string, but with auto completion of file names.
|
teCOK_Object | Object is a named object.
|
teCOK_Int | Any integer number.
|
teCOK_Double | |
teCOK_Prop | |
teCOK_Iface | |
teCOK_Reg | |
teCOK_Field | |
teCOK_Class | |
◆ temu_classCmdAddParam()
◆ temu_classGetCmd()
◆ temu_cmdAddOption()
TEMU_API void temu_cmdAddOption |
( |
void * |
Cmd, |
|
|
const char * |
OptName, |
|
|
temu_CmdOptionKind |
Type, |
|
|
int |
Required, |
|
|
const char * |
Doc, |
|
|
const char * |
Default |
|
) |
| |
Add named argument to command
- Parameters
-
Cmd | Pointer to the command object |
OptName | Option name |
Type | Option type |
Required | Pass 0 if the option is not required, otherwise required |
Doc | Option documentation |
Default | Default value of the option |
◆ temu_cmdGetData()
TEMU_API void* temu_cmdGetData |
( |
void * |
Ctxt | ) |
|
Get data pointer from command context This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Pointer to the context of the command |
- Returns
- data pointer
◆ temu_cmdGetInterpreter()
TEMU_API void* temu_cmdGetInterpreter |
( |
void * |
Ctxt | ) |
|
Get pointer to the command interpreter This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Pointer to the context of the command |
- Returns
- Pointer to interpreter
◆ temu_cmdGetOptionAsInteger()
TEMU_API int64_t temu_cmdGetOptionAsInteger |
( |
void * |
Ctxt, |
|
|
const char * |
OptName |
|
) |
| |
Get named option as integer from command context This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
OptName | Option name |
- Returns
- The integer bound to the named argument
◆ temu_cmdGetOptionAsObject()
TEMU_API void* temu_cmdGetOptionAsObject |
( |
void * |
Ctxt, |
|
|
const char * |
OptName |
|
) |
| |
Get named option as object pointer from command context This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
OptName | Option name |
- Returns
- Pointer to the option object
◆ temu_cmdGetOptionAsReal()
TEMU_API double temu_cmdGetOptionAsReal |
( |
void * |
Ctxt, |
|
|
const char * |
OptName |
|
) |
| |
Get named option as double from command context This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
OptName | Option name |
- Returns
- The real value of the option as double
◆ temu_cmdGetOptionAsString()
TEMU_API const char* temu_cmdGetOptionAsString |
( |
void * |
Ctxt, |
|
|
const char * |
OptName |
|
) |
| |
Get named option as string from command context This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
OptName | Option name |
- Returns
- C-string of the name of the option
◆ temu_cmdGetPosOpt()
TEMU_API const char* temu_cmdGetPosOpt |
( |
void * |
Ctxt, |
|
|
size_t |
Idx |
|
) |
| |
Get positional option at index This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
Idx | Index of the option |
- Returns
- The option at position Idx as a C-string
◆ temu_cmdGetPosOptSize()
TEMU_API size_t temu_cmdGetPosOptSize |
( |
void * |
Ctxt | ) |
|
Get number of positional options given This function shall be called in a command handler on the passed context.
- Parameters
-
- Returns
- The number of position optionals in Ctxt
◆ temu_cmdGetVariable()
TEMU_API const char* temu_cmdGetVariable |
( |
const char * |
Key | ) |
|
Get a variable in the command line
- Parameters
-
- Returns
- In case the variable is not found NULL, otherwise a borrowed string.
◆ temu_cmdOptionIsValid()
TEMU_API int temu_cmdOptionIsValid |
( |
void * |
Ctxt, |
|
|
const char * |
OptName |
|
) |
| |
Return 1 if the option is valid, 0 if invalid / not set This function shall be called in a command handler on the passed context.
- Parameters
-
Ctxt | Command context |
OptName | Option name |
- Returns
- 1 if the option is valid, 0 if invalid / not set
◆ temu_cmdSetVariable()
TEMU_API int temu_cmdSetVariable |
( |
const char * |
Key, |
|
|
const char * |
Value |
|
) |
| |
Set a variable in the command line
- Parameters
-
Key | Variable name (must match [A-Za-z_][A-Za-z0-9_]*) |
Value | Value to assign to variable |
- Returns
- Non-zero on errors
◆ temu_createClassCmd()
◆ temu_createCmd()
Create and register global command
- Parameters
-
Name | Name of command |
F | Command function to invoke |
Doc | Documentation string |
Data | Data pointer. Some commands e.g. disassemble will increase the address between invocations. This must be saved in some data object which can be provided when the command is created. |
◆ temu_execCommand()
TEMU_API int temu_execCommand |
( |
const char * |
Cmd | ) |
|
Executes a single command
- Parameters
-
Cmd | The command to be executed |
- Returns
- 0 on success, otherwise a non-zero value
◆ temu_execCommandFile()
TEMU_API int temu_execCommandFile |
( |
const char * |
File | ) |
|
Executes the commands in the file "File"
- Parameters
-
File | Path to the file with the commands to be executed |
- Returns
- 0 on success, otherwise a non-zero value
◆ temu_objectInvokeCmd()
◆ temu_parseCommandLineOptions()
TEMU_API int temu_parseCommandLineOptions |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Parses command line options The TEMU command supports a number of built in command line options. A simulator embedding TEMU may want initialise these options in the same way that the TEMU CLI does. Note that not all options are supported this way as some options will only be registered by the temu CLI application itself.
In general interactive options will not work (options that can be interpreted as a command). It is possible to use temu_printCommandLineHelp() to list currently registered options from an application that embedds temu.
- Parameters
-
argc | Number of arguments |
argv | Command line arguments |
- Returns
- 0 on success, otherwise non-zero value.
◆ temu_printCommandLineHelp()
TEMU_API void temu_printCommandLineHelp |
( |
void |
| ) |
|
Print command line help to temu stderr stream.
◆ temu_raiseCmdError()
TEMU_API int temu_raiseCmdError |
( |
void * |
I, |
|
|
const char * |
S, |
|
|
|
... |
|
) |
| |