fdhwlib
2.0.25
|
#include <cmds.h>
The abstract class cmds defines an interface for a simple command line parser.
With each call one command line is interpreted. Here two streams for input and output can be used.
Add mathematical functions. (Mean, Variance,..)
Implement a command to print the help lines help(FILE *fout, char *format, ...); Features:
Implement static members, that hold a kind of environment. The environment is based on a string array: Name, Value, description of the parameter. Provide functions to print, add, modify and delete the environment. Should be used for global settings required in more than one instruction set (row, col, page, ...). A specical field could take the value of the last operation. This will allow conditional scripting! Provide conditional commands!
cmds::cmds | ( | ) |
virtual cmds::~cmds | ( | ) | [virtual] |
virtual void cmds::fprintf | ( | FILE * | fout, |
const char * | msg, | ||
... | |||
) | [virtual] |
virtual void cmds::init | ( | FILE * | fout | ) | [virtual] |
Initialize the instruction set, e.g.
read parameter from inifile
virtual int cmds::interprete | ( | FILE * | fin, |
FILE * | fout, | ||
char * | line | ||
) | [virtual] |
Redefine this function to meet the needs of the task.
Reimplemented in GpsClockCmds, StdCmds, and EventLoopCmds.
int cmds::readUnsignedLong | ( | FILE * | fin, |
FILE * | fout, | ||
unsigned long * | data, | ||
int | n | ||
) |
Read data of the type unsigned long from the input stream.
The syntax allows comments and continuation in the next line. In each line maximal 10 values can be read. Comments are indicated by a "%" in the first column. If a line ends with an "\" the reading is continued in the following line.
fin | Input stream |
fout | Output stream |
data | pointer to the array of type unsigned long |
n | size of the array |
int cmds::readUnsignedShort | ( | FILE * | fin, |
FILE * | fout, | ||
unsigned short * | data, | ||
int | n, | ||
bool | hex = true |
||
) |
Read data of the type unsigned long from the input stream.
The syntax
allows comments and continuation in the next line. In each line maximal 10 values can be read. Comments are indicated by a "%" in the first column. If a line ends with an "\" the reading is continued in the following line.
fin | Input stream |
fout | Output stream |
data | pointer to the array of type unsigned long |
n | size of the array |
hex | true read hex format, false decimal numbers expected |
void cmds::setShell | ( | shell * | sh | ) |
Set the pointer to the shell object.
char* cmds::description [protected] |
char* cmds::name [protected] |
Reimplemented in GpsClockCmds.