LisaacTM Platform

COMMAND_LINE


Interface Command line (Unix).
Inherit/Insert Summary
parent_object No developed.
 
Access :
count
lower
upper
item
executable_name
 
Parser informations :
sswitch
The short option character switch. Default is '-'.
lswitch
The long option string switch. Default is "--".
unparsed
Array created after calling the parse slot. Contains unparsed items. Also return by the parse slot.
 
Slot Summary
end_option
End of option found while parsing.
end_index
If end_option is true, give the index of the first element after in unparsed. Bound validity must be checked as the end of option item can be the last item of the command line.
current_character
Current character in current item.
current_string
Current string.
 
Parser configuration :
set_sswitch
Set a new short option switch.
set_lswitch
Set a new long option switch.
set_unknown
Code to execute when a unknown option is read. The faulty string is passed in parameter.
set_bad_position
Code to execute when a bad position for a short argument is read. The short argument and the string containing it are passed as parameters with the description.
set_bad_number
Code to execute when not enough argument are supplied. The received number, expected number and description of the option are passed.
on_option long do
Add an option to parse and code to execute when encoutered.
on_arg long with do is
Add an argument to parse, with arguments number, code to execute when encoutered and description printed on failure.
 
Parsing :
parse
Return unparsed string
 
Data access :
is_last
Return TRUE if current_character is the last character of current_string;
next_character
Access to the next character in the current item. Changes current_character. Return 0 if end of current_string or current_string is NULL.
next_string
Acces to the next string. Changes current_string. Return NULL if end of strings in args.
 
Errors :
unknown_error
Code d'erreur sur une option inconnue.
bad_position_error
Code d'erreur sur une mauvaise position d'arguments.
bad_number_error
Code d'erreur sur un mauvais nombre d'arguments.
error
 

Inherit/Insert Detail

parent_object

.../base/io/command_line.li line #11

Section:
Inherit

Profile:
- SelfSELFparent_object : OBJECT

Access :

count

.../base/io/command_line.li line #40

Section:
Public

Profile:
- SelfSELFcount : INTEGER

lower

.../base/io/command_line.li line #42

Section:
Public

Profile:
- SelfSELFlower : INTEGER

upper

.../base/io/command_line.li line #44

Section:
Public

Profile:
- SelfSELFupper : INTEGER

item

.../base/io/command_line.li line #46

Section:
Public

Profile:
- SelfSELFitem   i : INTEGERSTRING

executable_name

.../base/io/command_line.li line #48

Section:
Public

Profile:
- SelfSELFexecutable_name : STRING

Parser informations :

sswitch

.../base/io/command_line.li line #54

Section:
Public

Profile:
- SelfSELFsswitch : CHARACTER

Description:
The short option character switch. Default is '-'.

lswitch

.../base/io/command_line.li line #57

Section:
Public

Profile:
- SelfSELFlswitch : ABSTRACT_STRING

Description:
The long option string switch. Default is "--".

unparsed

.../base/io/command_line.li line #60

Section:
Public

Profile:
- SelfSELFunparsed : FAST_ARRAYSTRING)

Description:
Array created after calling the parse slot. Contains unparsed items. Also return by the parse slot.

Detail slot

end_option

.../base/io/command_line.li line #64

Section:
Public

Profile:
- SelfSELFend_option : BOOLEAN

Description:
End of option found while parsing.

end_index

.../base/io/command_line.li line #67

Section:
Public

Profile:
- SelfSELFend_index : INTEGER

Description:
If end_option is true, give the index of the first element after in unparsed. Bound validity must be checked as the end of option item can be the last item of the command line.

current_character

.../base/io/command_line.li line #260

Section:
Public

Profile:
- SelfSELFcurrent_character : CHARACTER

Description:
Current character in current item.

current_string

.../base/io/command_line.li line #263

Section:
Public

Profile:
- SelfSELFcurrent_string : STRING

Description:
Current string.

Parser configuration :

set_sswitch

.../base/io/command_line.li line #75

Section:
Public

Profile:
- SelfSELFset_sswitch   char : CHARACTER

Description:
Set a new short option switch.

set_lswitch

.../base/io/command_line.li line #78

Section:
Public

Profile:
- SelfSELFset_lswitch   str : ABSTRACT_STRING

Description:
Set a new long option switch.

set_unknown

.../base/io/command_line.li line #81

Section:
Public

Profile:
- SelfSELFset_unknown   unknown_code_ :{ STRING; }

Description:
Code to execute when a unknown option is read. The faulty string is passed in parameter.

set_bad_position

.../base/io/command_line.li line #85

Section:
Public

Profile:
- SelfSELFset_bad_position   bad_position_code_ :{CHARACTERSTRINGABSTRACT_STRING); }

Description:
Code to execute when a bad position for a short argument is read. The short argument and the string containing it are passed as parameters with the description.

set_bad_number

.../base/io/command_line.li line #90

Section:
Public

Profile:
- SelfSELFset_bad_number   bad_number_code_ :{INTEGERINTEGERABSTRACT_STRING); }

Description:
Code to execute when not enough argument are supplied. The received number, expected number and description of the option are passed.

on_option long do

.../base/io/command_line.li line #94

Section:
Public

Profile:
- SelfSELFon_option   short : CHARACTER  long   long : ABSTRACT_STRING  do   code :{}

Description:
Add an option to parse and code to execute when encoutered.

on_arg long with do is

.../base/io/command_line.li line #103

Section:
Public

Profile:
- SelfSELFon_arg   short : CHARACTER  long   long : ABSTRACT_STRING  with   nb : INTEGER  do   code :{ FAST_ARRAYSTRING); }  is   description : ABSTRACT_STRING

Description:
Add an argument to parse, with arguments number, code to execute when encoutered and description printed on failure.

Parsing :

parse

.../base/io/command_line.li line #117

Section:
Public

Profile:
- SelfSELFparse : FAST_ARRAYSTRING)

Description:
Return unparsed string

Data access :

is_last

.../base/io/command_line.li line #266

Section:
Public

Profile:
- SelfSELFis_last : BOOLEAN

Description:
Return TRUE if current_character is the last character of current_string;

next_character

.../base/io/command_line.li line #269

Section:
Public

Profile:
- SelfSELFnext_character : CHARACTER

Description:
Access to the next character in the current item. Changes current_character. Return 0 if end of current_string or current_string is NULL.

next_string

.../base/io/command_line.li line #281

Section:
Public

Profile:
- SelfSELFnext_string : STRING

Description:
Acces to the next string. Changes current_string. Return NULL if end of strings in args.

Errors :

unknown_error

.../base/io/command_line.li line #297

Section:
Public

Profile:
- SelfSELFunknown_error   str : STRING

Description:
Code d'erreur sur une option inconnue.

bad_position_error

.../base/io/command_line.li line #300

Section:
Public

Profile:
- SelfSELFbad_position_error  ( c : CHARACTER, desc : ABSTRACT_STRING)

Description:
Code d'erreur sur une mauvaise position d'arguments.

bad_number_error

.../base/io/command_line.li line #303

Section:
Public

Profile:
- SelfSELFbad_number_error  ( r : INTEGER, e : INTEGER, desc : ABSTRACT_STRING)

Description:
Code d'erreur sur un mauvais nombre d'arguments.

error

.../base/io/command_line.li line #306

Section:
Public

Profile:
- SelfSELFerror