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

Header file for objects filtering in the shell. More...

#include "shell_commands.h"

Go to the source code of this file.

Classes

struct  filters_info
 

Macros

#define FILTER_MAXCLASSES   64
 Maximum number of classes for the filters.
 

Enumerations

enum  num_filter {
  FILTER_MINI , FILTER_SYNT , FILTER_IDEMS , FILTER_RNUM ,
  FILTER_LNUM , FILTER_JNUM , FILTER_HNUM , FILTER_RMAXSIZE ,
  FILTER_LMAXSIZE , FILTER_JMAXSIZE , FILTER_HMAXSIZE , FILTER_NUMSIZE
}
 
enum  bool_filter { FILTER_NOSIMC , FILTER_NOSMALLCOUNTER , FILTER_BOOLSIZE }
 

Functions

uint shell_extract_sizesynt (int i)
 Extracts the size of the syntactic monoid of an object.
 
uint shell_extract_sizemini (int i)
 Extracts the size of the minimal automaton of an object.
 
uint shell_extract_idemnum (int i)
 Extracts the number of idempotents in the syntactic monoid of an object.
 
uint shell_extract_rnum (int i)
 Extarcts the number of R-classes in the syntactic monoid of an object.
 
uint shell_extract_lnum (int i)
 Extarcts the number of L-classes in the syntactic monoid of an object.
 
uint shell_extract_jnum (int i)
 Extarcts the number of J-classes in the syntactic monoid of an object.
 
uint shell_extract_hnum (int i)
 Extarcts the number of H-classes in the syntactic monoid of an object.
 
uint shell_extract_rmaxsize (int i)
 Extracts the maximal size of an R-class in the syntactic monoid of an object.
 
uint shell_extract_lmaxsize (int i)
 Extracts the maximal size of an L-class in the syntactic monoid of an object.
 
uint shell_extract_jmaxsize (int i)
 Extracts the maximal size of a J-class in the syntactic monoid of an object.
 
uint shell_extract_hmaxsize (int i)
 Extracts the maximal size of an H-class in the syntactic monoid of an object.
 
int shell_retrieve_filters (com_parameters *pars, filters_info *info)
 Retrieves the filters from the command parameters.
 
int shell_filter_objects (com_parameters *pars, ob_type)
 Displays of all objects of a given type in memory.
 
int object_compare (int, int)
 Default comparison function for objects. Sorts according to the variable name.
 
int object_compare_numerical (int i1, int i2)
 Comparison function for objects. Sorts according to the numerical value given by the extractor function.
 
void object_sort_array (int(*comp)(int, int))
 Sorts the array of objects according to the comparison function passed as input.
 
int shell_sort (com_parameters *pars)
 Sorts the objects array according to a comparison function given as input.
 
int shell_filter_delete (com_parameters *pars, ob_type type)
 Deletes all object that do not satify the filters.
 
int shell_delete (com_parameters *pars, const char *str)
 Deletes an object.
 
int shell_delete_all (com_parameters *pars, const char *str)
 Deletes all objects in memory.
 
int shell_recursive_init (char *varname, com_parameters *pars, const char *str)
 Initializes a recursive definition.
 
int shell_reset (com_parameters *pars, const char *str)
 Deletes the state names in an NFA.
 

Variables

uint(* num_extractors [FILTER_NUMSIZE])(int i)
 Array of pointers to functions that extract numerical values from objects.
 
bool(* bool_extractors [FILTER_BOOLSIZE])(int i)
 Array of pointers to functions that extract boolean values from objects.
 
uint(* extractor )(int)
 Pointer to the function that extracts a numerical value from an object for the object_compare_numerical function.
 

Detailed Description

Header file for objects filtering in the shell.

Enumeration Type Documentation

◆ bool_filter

Enumerator
FILTER_NOSIMC 

No simple counter.

FILTER_NOSMALLCOUNTER 

No small counter.

◆ num_filter

enum num_filter
Enumerator
FILTER_MINI 

Filter by the size of the minimal automaton.

FILTER_SYNT 

Filter by the size of the syntactic monoid.

FILTER_IDEMS 

Filter by the number of idempotents in the syntactic monoid.

FILTER_RNUM 

Filter by the number of R-classes in the syntactic monoid.

FILTER_LNUM 

Filter by the number of L-classes in the syntactic monoid.

FILTER_JNUM 

Filter by the number of J-classes in the syntactic monoid.

FILTER_HNUM 

Filter by the number of H-classes in the syntactic monoid.

FILTER_RMAXSIZE 

Filter by the maximal size of an R-class in the syntactic monoid.

FILTER_LMAXSIZE 

Filter by the maximal size of an L-class in the syntactic monoid.

FILTER_JMAXSIZE 

Filter by the maximal size of a J-class in the syntactic monoid.

FILTER_HMAXSIZE 

Filter by the maximal size of an H-class in the syntactic monoid.

Function Documentation

◆ object_compare()

int object_compare ( int i1,
int i2 )

Default comparison function for objects. Sorts according to the variable name.

Returns
A negative value if the first object should be placed before the second one, a positive value if the second object should be placed before the first one, and 0 if the two objects are equal.
Parameters
i1The index of the first object.
i2The index of the second object.

◆ object_compare_numerical()

int object_compare_numerical ( int i1,
int i2 )

Comparison function for objects. Sorts according to the numerical value given by the extractor function.

Remarks
Recursive definition objects are placed at the end of the list (they are not considered by extarctor functions).
Returns
A negative value if the first object should be placed before the second one, a positive value if the second object should be placed before the first one, and 0 if the two objects are equal.

◆ object_sort_array()

void object_sort_array ( int(* comp )(int, int))

Sorts the array of objects according to the comparison function passed as input.

Remarks
Uses a heap sort algorithm.
Parameters
compThe comparison function.

◆ shell_delete()

int shell_delete ( com_parameters * pars,
const char * str )

Deletes an object.

Remarks
-1 in case of success, -2 in case of error.
Parameters
parsThe parameters of the command.
strThe string used to call the command.

◆ shell_delete_all()

int shell_delete_all ( com_parameters * pars,
const char * str )

Deletes all objects in memory.

Remarks
-1 in case of success, -2 in case of error.
Parameters
parsThe parameters of the command.
strThe string used to call the command.

◆ shell_extract_hmaxsize()

uint shell_extract_hmaxsize ( int i)

Extracts the maximal size of an H-class in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The maximal size of an H-class in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_hnum()

uint shell_extract_hnum ( int i)

Extarcts the number of H-classes in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The number of H-classes in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_idemnum()

uint shell_extract_idemnum ( int i)

Extracts the number of idempotents in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The number of idempotents in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_jmaxsize()

uint shell_extract_jmaxsize ( int i)

Extracts the maximal size of a J-class in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The maximal size of a J-class in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_jnum()

uint shell_extract_jnum ( int i)

Extarcts the number of J-classes in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The number of J-classes in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_lmaxsize()

uint shell_extract_lmaxsize ( int i)

Extracts the maximal size of an L-class in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The maximal size of an L-class in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_lnum()

uint shell_extract_lnum ( int i)

Extarcts the number of L-classes in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The number of L-classes in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_rmaxsize()

uint shell_extract_rmaxsize ( int i)

Extracts the maximal size of an R-class in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The maximal size of an R-class in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_rnum()

uint shell_extract_rnum ( int i)

Extarcts the number of R-classes in the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The number of R-classes in the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_sizemini()

uint shell_extract_sizemini ( int i)

Extracts the size of the minimal automaton of an object.

Remarks
The minimal automaton of the object is computed if it has not already been computed.
Returns
The size of the minimal automaton of the object or UINT_MAX if the object is a recursive definition or if the minimal automaton could not be computed.
Parameters
ithe index of the object.

◆ shell_extract_sizesynt()

uint shell_extract_sizesynt ( int i)

Extracts the size of the syntactic monoid of an object.

Remarks
The syntactic morphism of the object is computed if it has not already been computed.
Returns
The size of the syntactic monoid of the object or UINT_MAX if the object is a recursive definition or if the syntactic morphism could not be computed.
Parameters
ithe index of the object.

◆ shell_filter_delete()

int shell_filter_delete ( com_parameters * pars,
ob_type type )

Deletes all object that do not satify the filters.

Remarks
-1 in case of success, -2 in case of error.

◆ shell_filter_objects()

int shell_filter_objects ( com_parameters * pars,
ob_type type )

Displays of all objects of a given type in memory.

Returns
-1 in case of success, -2 in case of error.
Parameters
parsThe parameters of the command.
typeThe type of the objects to display.

◆ shell_recursive_init()

int shell_recursive_init ( char * varname,
com_parameters * pars,
const char * str )

Initializes a recursive definition.

Remarks
Index of the new object in case of success, -2 in case of error.
Parameters
varnameThe variable name for the new object.
parsThe parameters of the command.
strstring used to call the command.

◆ shell_reset()

int shell_reset ( com_parameters * pars,
const char * str )

Deletes the state names in an NFA.

Returns
-1 in case of success, -2 in case of error.
Parameters
parsThe parameters of the command.
strstring used to call the command.

◆ shell_retrieve_filters()

int shell_retrieve_filters ( com_parameters * pars,
filters_info * info )

Retrieves the filters from the command parameters.

Returns
-1 in case of success, -2 in case of error.
Parameters
parsThe parameters of the command.
infoThe structure to fill with the filters information.

Variable Documentation

◆ extractor

uint(* extractor) (int) ( int )
extern

Pointer to the function that extracts a numerical value from an object for the object_compare_numerical function.

Remarks
Initially set to NULL.