The system supports tree containing unlimited
number of folders and commands. CLI can check the arguments supplied by
the user before application function handling the menu is called. CLI prints command help
in case wrong arguments used, supports one default argument '?' for
all commands. CLI has an ability to add commands accepted on
all levels of the tree TBD. Two default commands are accepted on
all levels of the tree '.' - return one level up, '/' - return to
the top, '?' - print help for the folder or list of available on the current level commands.
The library contains one source file and does not require any additional source code/libraries for compilation.
ANSI C was used for implementation of the library and the code was tested with Borland C and GNU C compilers.
Older version was tested with vxWorks.
PC based sample application (Borland project) is included for testing/debug purposes (see file cliWinSim.c).
System can handle more than one command tree TBD
Application can supply a flag to be checked before a command called (see appData). Flag is stored in the CLI instance
and can be used for supporting different levels of access. When application constructs a menu it provides optional value,
let's call it VAL, when application creates new CLI object, for example after Telnet login, it builds a new value,
let's call it MASK. For every incoming command CLI will calculate (VAL bitwise and MASK) and call the command only if result
of the operation is zero. More than one CLI instance can be supported (see
function cliCreate() ). 32 bits I/O identifier will be forwarded to the application functions to make possible output
to different I/Os (2 telnet connections, for example). System does
not assume that malloc() exists. Memory allocation/free functions should be provided by the application
at initialization time. CLI allocates blocks of limited and known size. It means that memory allocation can be implemented as pool
(stack or list) of blocks created at the initialization time. CLI will call
allocation only when application creates menus. CLI calls 'free' only when application removes menus or call cliClose().
CLI stores it's own internal data in the structure of known at compilation time size provided by the application
and can be a static variable, a task variable or
RAM area dynamically allocated at initialization time. CLI provides Notify method to be called when there is input to handle
and requires from application to provide callback for output/print. CLI stores multiple 'current menu' (place in the tree of menus)
for different I/O devices/ports. CLI forwards I/O descriptor (pointer to printout function) to all callbacks provided by the
application. This way callback will use the same output function calling CLI instances use.
See documentation and external file for details and more comments.