|
This part of the guide contains detailed descriptions of the
BUSH built-in packages.
4.5 Source_Info Package
The BUSH source_info package provides information
about the current script. It can be used to create error messages
that identify the file and the line number where a problem was encountered.
GCC Ada equivalent: GNAT.Source_Info
s := source_info.enclosing_entity
Return the name of the script as identified in a procedure block (if
any)
Example: put_line( source_info.enclosing_entity );
Ada Equivalent: GNAT.Source_Info.Enclosing_Entity
Parameters:
s |
return value |
string |
required |
the script name |
|
s := source_info.file
Return the name name of the script file, no path information. It is
the basename for the script.
Example: put_line( source_info.file );
Ada Equivalent: GNAT.Source_Info.File
Parameters:
s |
return value |
string |
required |
the script file name |
|
p := source_info.line
Return the line number of the line being currently being executed.
Example: put_line( source_info.line );
Ada Equivalent: GNAT.Source_Info.Line
Parameters:
p |
return value |
positive |
required |
the current line number |
|
n := source_info.script_size
Return the size of the compiled script
Example: put_line( source_info.script_size );
Restrictions: not allowed with pragma Ada_95
Ada Equivalent: none (AdaScript extension)
Parameters:
n |
return value |
natural |
required |
the number of bytes |
|
s := source_info.source_location
Return the filename and current line number separated by a colon
Example: put_line( source_info.source_location );
Ada Equivalent: GNAT.Source_Info.Source_Location
Parameters:
s |
return value |
string |
required |
the source location |
|
n := source_info.symbol_table_size
Return the number of symbols (variables, etc.) defined
Example: put_line( source_info.symbol_table_size );
Restrictions: not allowed with pragma Ada_95
Ada Equivalent: none (AdaScript extension)
Parameters:
n |
return value |
natural |
required |
the number of symbols |
|
End of Document
|