Source_Info Package
The SparForte 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 );
Parameters
Param
Mode
Type
Default
Description
s
return value
string
required
the script name
Exceptions
-
See Also
-
Compare With
Ada: GNAT.Source_Info.Enclosing_Entity
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 );
Parameters
Param
Mode
Type
Default
Description
s
return value
string
required
the script file name
Exceptions
-
See Also
-
Compare With
Ada: GNAT.Source_Info.File PHP: __FILE__
p := source_info.line
Return the line number of the line being currently being executed.
Example
put_line( source_info.line );
Parameters
Param
Mode
Type
Default
Description
p
return value
positive
required
the current line number
Exceptions
-
See Also
-
Compare With
Ada: GNAT.Source_Info.Line PHP: __LINE__
n := source_info.script_size
Return the size of the compiled script
Example
put_line( source_info.script_size );
Parameters
Param
Mode
Type
Default
Description
n
return value
natural
required
the number of bytes
Exceptions
-
See Also
-
Compare With
-
s := source_info.source_location
Return the filename and current line number separated by a colon,
useful for error messages.
Example
put_line( source_info.source_location );
Parameters
Param
Mode
Type
Default
Description
s
return value
string
required
the source location
Exceptions
-
See Also
-
Compare With
Ada: GNAT.Source_Info.Source_Location PHP: __FILE__ , __LINE__
n := source_info.symbol_table_size
Return the number of identifiers (variables, functions, etc.) defined
Example
put_line( source_info.symbol_table_size );
Parameters
Param
Mode
Type
Default
Description
n
return value
natural
required
the number of symbols
Exceptions
-
See Also
-
Compare With
-