/home/doxygen/libascend/compiler/commands.h File Reference


Detailed Description

Routines to Describe Interface Commands.
  When including commands.h, make sure these files are included first:
         include "utilities/ascConfig.h"
  

Go to the source code of this file.

Defines

#define MAX_COMMAND_ARGS   4

Typedefs

typedef void(*) InterfaceCommandF (void)

Enumerations

enum  arg_type { instance_arg, definition_arg, id_arg, shell_arg }

Functions

void InitializeCommands (void)
void DestroyCommands (void)
void AddCommand (int dummy,...)
unsigned long NumberCommands (void)
CONST char * CommandName (unsigned long cmd_number)
CONST char * CommandHelp (unsigned long cmd_number)
void CommandFunc (unsigned long int cmd_number, InterfaceCommandF *func)
int CommandTerminate (unsigned long cmd_number)
int CommandNumArgs (unsigned long cmd_number)
enum arg_type CommandArgument (unsigned long cmd_number, int n)
void CommandArgsPrint (FILE *fp, unsigned long int cmd_number)
void LimitCommand (unsigned long *lower, unsigned long *upper, CONST char *str, int place)
void CompleteCommand (unsigned long lower, unsigned long upper, char *str, int *place)
unsigned long FindCommand (CONST char *string)


Define Documentation

#define MAX_COMMAND_ARGS   4

The maximum number of arguments a command can have.


Typedef Documentation

typedef void(*) InterfaceCommandF(void)

Type for command functions added using AddCommand().


Enumeration Type Documentation

enum arg_type

Command argument types.

Enumerator:
shell_arg  same as id almost


Function Documentation

void AddCommand ( int  dummy,
  ... 
)

Adds a command to the command list. The arguments expected are as follows:

void CommandArgsPrint ( FILE *  fp,
unsigned long int  cmd_number 
)

Prints the args expected for a command on fp. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand().

enum arg_type CommandArgument ( unsigned long  cmd_number,
int  n 
)

Returns the type of the n'th argument for a command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand(). n ranges from 0 to CommandNumArgs(pos)-1.

void CommandFunc ( unsigned long int  cmd_number,
InterfaceCommandF func 
)

Returns the function of a command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand(). func is the address where the pointer to the command's function will be stored.

CONST char* CommandHelp ( unsigned long  cmd_number  ) 

Returns the short help message of a command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand().

CONST char* CommandName ( unsigned long  cmd_number  ) 

Returns the name of a command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand().

int CommandNumArgs ( unsigned long  cmd_number  ) 

Returns the number of arguments for a command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand().

int CommandTerminate ( unsigned long  cmd_number  ) 

Returns non-zero if a command is a termination command. The cmd_number must be in the range (1 .. NumberCommands()), and may be looked up using FindCommand().

void CompleteCommand ( unsigned long  lower,
unsigned long  upper,
char *  str,
int *  place 
)

Fills in all the letters that are shared by commands between lower and upper. It is assumed that str has enough space to hold any command.

void DestroyCommands ( void   ) 

Destroys the command structure created by InitializeCommands().

unsigned long FindCommand ( CONST char *  string  ) 

Returns the number of the command matching string, or 0 if none does. Exact matches only.

void InitializeCommands ( void   ) 

Initializes the command list. This function must be called before anything else in this module. It is a logical error to call this function more than once, but will be tolerated. Call DestroyCommands() when finished using the command facilities.

void LimitCommand ( unsigned long *  lower,
unsigned long *  upper,
CONST char *  str,
int  place 
)

Finds the best possible upper and lower bound on the command. It is assumed that on entry that the commands between lower and upper match up to "place" letters of string. When str cannot be a command, *lower > *upper on return. In such cases, the return *lower and *upper may be outside the original lower and upper.

unsigned long NumberCommands ( void   ) 

Returns the number of defined commands.


Generated on Thu Jul 17 04:00:21 2008 for libascend by  doxygen 1.5.1