Mescal
Loading...
Searching...
No Matches
shell_keywords.h File Reference

Keywords and commands used in the shell. More...

#include "shell_languages.h"
#include "type_basic.h"
#include <stdbool.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  string_chain
 Chain of strings in a command. More...
 
struct  com_parameters
 Parameters of a command. More...
 
struct  com_command
 A command. More...
 

Typedefs

typedef struct string_chain string_chain
 Chain of strings in a command.
 
typedef struct com_parameters com_parameters
 Parameters of a command.
 
typedef struct com_command com_command
 A command.
 

Enumerations

enum  com_keyword {
  KY_INTERFACE , KY_SAVESESSION , KY_LOADSESSION , KY_OPEN ,
  KY_SAVE , KY_DELETE , KY_CLEAR , KY_SORT ,
  KY_INFO , KY_EXSEARCH , KY_EXINIT , KY_EXINITFP ,
  KY_EXINITNEG , KY_EXCONTINUE , KY_EXRETRIEVE , KY_EXALL ,
  KY_NEXALL , KY_FPEXALL , KY_BUGSEARCH , KY_INSIDE ,
  KY_OUTSIDE , KY_LIST , KY_AUTOMATA , KY_MORPHISMS ,
  KY_GROUPS , KY_REGEXPS , KY_RECDEFS , KY_TOGGLE ,
  KY_TOGGLEMEMB , KY_TIMESTATS , KY_LATEX , KY_MINI ,
  KY_THOMPSON , KY_GLUSHKOV , KY_HOPCROFT , KY_BMCK ,
  KY_INTERSEC , KY_ELIMEPS , KY_BRZOZO , KY_KLEENE ,
  KY_MIRROR , KY_CONCAT , KY_RESET , KY_TRIMNFA ,
  KY_UNION , KY_RUN , KY_RNFA , KY_RDFA ,
  KY_INVTRANS , KY_DYCKTRANS , KY_RECDEF , KY_PERMUT ,
  KY_COUNTER , KY_AUTODA , KY_CYCLETRIV , KY_DETERMINIZE ,
  KY_COMPLEMENT , KY_NOSIMC , KY_FOLDING , KY_DIRECTPRODUCT ,
  KY_SYNT , KY_RCAY , KY_LCAY , KY_MULT ,
  KY_IDEMS , KY_ORDER , KY_IMAGE , KY_GKER ,
  KY_MKER , KY_AKER , KY_ORB , KY_COMMUT ,
  KY_LETTERIND , KY_RECINIT , KY_SEPAR , KY_MEMB ,
  KY_CHIERA , KY_NAVHIERA , KY_NHIERA , KY_FPHIERA ,
  KY_RSIZE , KY_LSIZE , KY_JSIZE , KY_HSIZE ,
  KY_RNUM , KY_LNUM , KY_JNUM , KY_HNUM ,
  KY_RMAXSIZE , KY_LMAXSIZE , KY_JMAXSIZE , KY_HMAXSIZE ,
  KY_NOT , KY_FILTER , KY_NOSMALLCOUNTER , KY_COMEND ,
  KY_HTGEN , KY_AT , KY_ATT , KY_SF ,
  KY_UL , KY_TLX , KY_PPT , KY_PT ,
  KY_LT , KY_LTT , KY_ST , KY_DD ,
  KY_MOD , KY_MODP , KY_AMT , KY_AMTP ,
  KY_GR , KY_GRP , KY_REG , KY_EMPTY ,
  KY_POL , KY_POL2 , KY_BPOL , KY_BPOL2 ,
  KY_UBPOL , KY_UBPOL2 , KY_UPOL , KY_LPOL ,
  KY_RPOL , KY_MPOL , KY_TLC , KY_TLC2 ,
  KY_FLC , KY_FLC2 , KY_PLC , KY_PLC2 ,
  KY_JORB , KY_KNAST , KY_NULL
}
 The keywords.
 
enum  com_type { CMT_RAW , CMT_IND , CMT_KEY }
 The two kinds of commands. More...
 

Functions

void keywords_add_key (com_keyword key, const char *str)
 Initialization of a single keyword.
 
void keywords_add_all_keys (void)
 Initialization of all the keywords.
 
void print_string_chain (const string_chain *stchain, FILE *out)
 Display a string chain.
 
void print_command (com_command *com, FILE *out)
 Display a command.
 
const char * keywordtostring (com_keyword key)
 Convert a keyword to the associated string.
 
com_keyword string_to_keyword (const char *str)
 Convert a string to a keyword.
 
bool check_varname (const char *str)
 Check if a variable name is valid: it is not a keyword.
 
bool com_isclass (com_command *com)
 Check if a command is a class.
 
bool com_israw (const com_command *com)
 Check if a command is raw text.
 
bool com_single (const com_command *com)
 Check if a command is a single link without parameters.
 
bool com_single_par (const com_command *com)
 Check if a command is a single link with or without parameters.
 
int com_nbparams (const com_parameters *pars)
 Computes the number of parameters of a command.
 
com_commandcom_getparam (const com_parameters *com, int i)
 Gets the n-th parameter of a command.
 
com_keyword key_from_string_chain (const string_chain *strchain)
 Get the keyword associated with the first link in a string chain.
 
com_keyword key_from_string_chain_single (const string_chain *strchain)
 Get the keyword associated with a single link string chain.
 
string_chaincom_make_string_chain (char *, string_chain *)
 Adds another link to a string chain.
 
com_parameterscom_make_parameters (com_command *, com_parameters *)
 Adds a new parameter to a parameters chain.
 
com_commandcom_make_command (char *, com_command *)
 Adds a new link to a command.
 
com_commandcom_init_command (char *, com_parameters *)
 Initializes a single link command.
 
com_commandcom_init_rawcommand (char *)
 Initializes a raw text command.
 
com_commandcom_init_indexing (char *, char *)
 Initializes an indexed command.
 
void com_free_string_chain (string_chain *)
 Frees a string chain.
 
void com_free_command (com_command *)
 Frees a command.
 
void com_free_parameters (com_parameters *)
 Frees the parameters of a command.
 

Detailed Description

Keywords and commands used in the shell.

Enumeration Type Documentation

◆ com_type

enum com_type

The two kinds of commands.

Enumerator
CMT_RAW 

Raw text command (no parameters, no chain)

CMT_IND 

Indexed command (no parameters, with chain).

CMT_KEY 

Standard command (with parameters, with chain).

Function Documentation

◆ check_varname()

bool check_varname ( const char * str)

Check if a variable name is valid: it is not a keyword.

Returns
True if the variable name is valid, false otherwise.
Parameters
strThe variable name.

◆ com_free_command()

void com_free_command ( com_command * thecom)

Frees a command.

Parameters
thecomThe command.

◆ com_free_parameters()

void com_free_parameters ( com_parameters * params)

Frees the parameters of a command.

Parameters
paramsThe parameters.

◆ com_free_string_chain()

void com_free_string_chain ( string_chain * thechain)

Frees a string chain.

Parameters
thechainThe string chain.

◆ com_getparam()

com_command * com_getparam ( const com_parameters * com,
int i )

Gets the n-th parameter of a command.

Returns
The n-th parameter of the command.
Parameters
comThe parameters of the command.
iThe index of the parameter.

◆ com_init_command()

com_command * com_init_command ( char * s,
com_parameters * params )

Initializes a single link command.

Returns
The initialized command.
Parameters
sThe string of the link.
paramsThe parameters of the command.

◆ com_init_indexing()

com_command * com_init_indexing ( char * s,
char * num )

Initializes an indexed command.

Returns
The initialized command.
Parameters
sThe string of the link.
numThe index of the command (must be a number).

◆ com_init_rawcommand()

com_command * com_init_rawcommand ( char * s)

Initializes a raw text command.

Returns
The initialized command.
Parameters
sThe raw text.

◆ com_isclass()

bool com_isclass ( com_command * com)

Check if a command is a class.

Returns
True if the command is a class, false otherwise.
Parameters
comThe command.

◆ com_israw()

bool com_israw ( const com_command * com)

Check if a command is raw text.

Returns
True if the command is raw text, false otherwise.
Parameters
comThe command.

◆ com_make_command()

com_command * com_make_command ( char * s,
com_command * thecom )

Adds a new link to a command.

Returns
The updated command.
Parameters
sThe string of the link.
thecomThe original command.

◆ com_make_parameters()

com_parameters * com_make_parameters ( com_command * theparam,
com_parameters * params )

Adds a new parameter to a parameters chain.

Returns
The updated parameters.
Parameters
theparamThe parameter.
paramsThe original parameters.

◆ com_make_string_chain()

string_chain * com_make_string_chain ( char * s,
string_chain * thechain )

Adds another link to a string chain.

Returns
The new string chain.
Parameters
sThe string.
thechainThe original string chain.

◆ com_nbparams()

int com_nbparams ( const com_parameters * pars)

Computes the number of parameters of a command.

Returns
The number of parameters of the command.
Parameters
parsThe parameters of the command.

◆ com_single()

bool com_single ( const com_command * com)

Check if a command is a single link without parameters.

Returns
True if the command is a single link without parameters, false otherwise.
Parameters
comThe command.

◆ com_single_par()

bool com_single_par ( const com_command * com)

Check if a command is a single link with or without parameters.

Returns
True if the command is a single link with or without parameters, false otherwise.
Parameters
comThe command.

◆ key_from_string_chain()

com_keyword key_from_string_chain ( const string_chain * strchain)

Get the keyword associated with the first link in a string chain.

Returns
The keyword associated with the first link in a string chain.
Parameters
strchainThe string chain.

◆ key_from_string_chain_single()

com_keyword key_from_string_chain_single ( const string_chain * strchain)

Get the keyword associated with a single link string chain.

Remarks
If the chain is not a single link chain, the function returns KY_NULL.
Returns
The keyword associated with the single link string chain.
Parameters
strchainThe string chain.

◆ keywords_add_key()

void keywords_add_key ( com_keyword key,
const char * str )

Initialization of a single keyword.

Parameters
keyThe keyword.
strThe string corresponding to the keyword.

◆ keywordtostring()

const char * keywordtostring ( com_keyword key)

Convert a keyword to the associated string.

Returns
The string corresponding to the keyword.
Parameters
keyThe keyword.

◆ print_command()

void print_command ( com_command * com,
FILE * out )

Display a command.

Parameters
comThe command.
outThe output stream.

◆ print_string_chain()

void print_string_chain ( const string_chain * stchain,
FILE * out )

Display a string chain.

Parameters
stchainThe string chain.
outThe output stream.

◆ string_to_keyword()

com_keyword string_to_keyword ( const char * str)

Convert a string to a keyword.

Remarks
If the string does not correspond to any keyword, the function returns KY_NULL.
Returns
The keyword corresponding to the string.
Parameters
strThe string.