TEMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
CommandLine.h
Go to the documentation of this file.
1 //===-- temu-c/CommandLine.h - T-EMU Command Line ---------------*- C++ -*-===//
2 //
3 // T-EMU: The Terma Emulator
4 // (c) Terma 2015, 2019
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_COMMAND_LINE
10 #define TEMU_COMMAND_LINE
11 
13 #include <stddef.h>
14 #include <stdint.h>
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
34 TEMU_API int temu_parseCommandLineOptions(int argc, const char *argv[]);
35 
40 
46 TEMU_API int temu_execCommandFile(const char *File);
47 
53 TEMU_API int temu_execCommand(const char *Cmd);
54 
55 // User command handlers implement this interface. The pointer
56 // argument is a pointer to an opaque context. Use the functions below
57 // to access properties from the context.
58 typedef int (*temu_CommandFunc)(void *);
59 
61 typedef enum temu_CmdOptionKind {
70 
79 
80 TEMU_API void *temu_createCmd(const char *Name, temu_CommandFunc F,
81  const char *Doc, void *Data);
82 
90 TEMU_API void temu_cmdAddOption(void *Cmd, const char *OptName,
91  temu_CmdOptionKind Type, int Required,
92  const char *Doc, const char *Default);
93 
99 TEMU_API void *temu_cmdGetData(void *Ctxt);
100 
106 TEMU_API void *temu_cmdGetInterpreter(void *Ctxt);
107 
114 TEMU_API int64_t temu_cmdGetOptionAsInteger(void *Ctxt, const char *OptName);
115 
122 TEMU_API void *temu_cmdGetOptionAsObject(void *Ctxt, const char *OptName);
123 
130 TEMU_API const char *temu_cmdGetOptionAsString(void *Ctxt, const char *OptName);
131 
138 TEMU_API double temu_cmdGetOptionAsReal(void *Ctxt, const char *OptName);
139 
145 TEMU_API size_t temu_cmdGetPosOptSize(void *Ctxt);
146 
153 TEMU_API const char *temu_cmdGetPosOpt(void *Ctxt, size_t Idx);
154 
161 TEMU_API int temu_cmdOptionIsValid(void *Ctxt, const char *OptName);
162 
167 TEMU_API int temu_cmdSetVariable(const char *Key, const char *Value);
168 
173 TEMU_API const char *temu_cmdGetVariable(const char *Key);
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /* !TEMU_COMMAND_LINE */
int(* temu_CommandFunc)(void *)
Definition: CommandLine.h:58
TEMU_API void * temu_createCmd(const char *Name, temu_CommandFunc F, const char *Doc, void *Data)
TEMU_API int temu_parseCommandLineOptions(int argc, const char *argv[])
TEMU_API size_t temu_cmdGetPosOptSize(void *Ctxt)
TEMU_API const char * temu_cmdGetOptionAsString(void *Ctxt, const char *OptName)
TEMU_API int temu_execCommandFile(const char *File)
TEMU_API int temu_cmdSetVariable(const char *Key, const char *Value)
TEMU_API void * temu_cmdGetInterpreter(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 const char * temu_cmdGetVariable(const char *Key)
Path is a string, but with auto completion of file names.
Definition: CommandLine.h:63
TEMU_API void temu_printCommandLineHelp(void)
TEMU_API int64_t temu_cmdGetOptionAsInteger(void *Ctxt, const char *OptName)
Object is a named object.
Definition: CommandLine.h:64
TEMU_API void temu_cmdAddOption(void *Cmd, const char *OptName, temu_CmdOptionKind Type, int Required, const char *Doc, const char *Default)
TEMU_API double temu_cmdGetOptionAsReal(void *Ctxt, const char *OptName)
Any integer number.
Definition: CommandLine.h:65
TEMU_API void * temu_cmdGetData(void *Ctxt)
TEMU_API int temu_execCommand(const char *Cmd)
temu_CmdOptionKind
Option types.
Definition: CommandLine.h:61
TEMU_API void * temu_cmdGetOptionAsObject(void *Ctxt, const char *OptName)
#define TEMU_API
Definition: Attributes.h:53