fdhwlib  2.0.25

#include <cmds.h>

Inheritance diagram for cmds:
EventLoopCmds GpsClockCmds StdCmds

List of all members.

Public Member Functions

Protected Attributes


Detailed Description

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.

Todo:

Add mathematical functions. (Mean, Variance,..)

Implement a command to print the help lines help(FILE *fout, char *format, ...); Features:

  • The format should be similar to the printf-Style,
  • a variable number of arguments can be given (for the implementation compare Pbus::debug).
  • The width of the two columns is defined in this function
  • The second column is adjusted to the width of the screen.

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!

Definition at line 55 of file cmds.h.


Constructor & Destructor Documentation

cmds::cmds ( )
virtual cmds::~cmds ( ) [virtual]

Member Function Documentation

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.

Returns:
Status of the command execution: 0 no command found 1 command executed, 2 command quit

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.

Parameters:
finInput stream
foutOutput stream
datapointer to the array of type unsigned long
nsize of the array
Returns:
The number of elements read
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.

Parameters:
finInput stream
foutOutput stream
datapointer to the array of type unsigned long
nsize of the array
hextrue read hex format, false decimal numbers expected
Returns:
The number of elements read
void cmds::setShell ( shell sh)

Set the pointer to the shell object.


Member Data Documentation

char* cmds::description [protected]

Definition at line 119 of file cmds.h.

char* cmds::name [protected]

Definition at line 117 of file cmds.h.

shell* cmds::sh [protected]

Reimplemented in GpsClockCmds.

Definition at line 121 of file cmds.h.


The documentation for this class was generated from the following file: