[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

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 := enclosing_entity - name of script (if a procedure block)
  s := file - file name without a path
  p := line - current line number
  n := script_size - size of compiled script (bytes)
  s := source_location - file and line number
  n := symbol_table_size - number of identifiers
 
Help Command: Contents of the source_info package

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

-

[Right Submenu]

 Summary

 arrays

 btree_io

 calendar

 cgi

 chains

 command_line

 db/ postgresql

 dbm

 directory_operations

 doubly_linked...

 dynamic_hash_...

 enums

 exceptions

 files

 gnat.cgi

 gnat.crc32

 hash_io

 lock_files

 memcache

 memcache.highread

 mysql

 mysqlm

 numerics

 os

 pen

 pen (OpenGL)

 records

 sound

 source_info

 stats

 strings

 System

 teams

 templates

 text_io

 units

[Back to Top] Back To Top [Small Forte Symbol]