Package Summary
AdaScript contains hundreds of built-in constants, variables, functions and
procedures. Many of these are grouped into collections called packages.
Built-in Packages
AdaScript includes the following packages:
-
arrays - contains general array operations
-
btree_io - Berkeley DB B-Tree files
-
calendar - contains time operations
-
cgi - CGI variables and HTML cookie handling
-
chains - contains information on the current chain
-
command_line - the script name, parameters and return value
-
db - PostgreSQL database interface
-
dbm - PostgreSQL database (multiple connections) interface
-
directory_operations - manage directories
-
doubly_linked_lists - contains linked list operations
-
dynamic_hash_tables - contains hash table operations
-
enums - contains general enumerated type operations
-
exceptions - contains exception handling operations
-
files - contains general file and directory operations
-
gnat.cgi - contains GNAT.CGI functions
-
gnat.crc32 - cyclic redundancy check calculator
-
hash_io - Berkeley DB Hash files
-
lock_files - create and destroy lock files
-
memcache - memcache network cache interface
-
memcache.highread - memcache network cache interface - high reading / high redundancy
-
mysql - MySQL database interface
-
mysqlm - MySQL multiple connections database interface
-
numerics - contains mathematical functions and constants
-
os - miscellaneous operating system functions
-
pen - graphics, drawing and animation
-
pen (OpenGL) - OpenGL bindings for pen package
-
records - contains general record operations
-
sound - play sounds, music or adjust the system mixer
-
source_info - the script file name and current statistics
-
stats - statistics on numeric arrays
-
strings - contains string operations
-
System - contains information about the computer a script is running
-
teams - the development team
-
templates - additional capabilities for templates
-
text_io - console and text file input and output
-
units - conversion between common measurements
These packages are referenced by name and are described in detail later
in this guide.
Using Built-in Package Subprograms
To use a function or constant inside a package, prefix the function
with the name of the package. For example, to use the "length" function
in the "strings" package, refer to it as "strings.length".
=> ? strings.length( "PegaSoft" )
8
The built-in Text_IO package is treated as an inherent part of the language
and doesn't use a prefx of "Text_IO". This is the only package that doesn't
use a package prefix.
Parameter Types
Parameters to a command have a mode which determine how the parameter
is treated:
-
in - the parameter is read only. This is not the same as C/C++/Java's
call-by-value because an in parameter is a constant and the value
cannot be changed.
-
out - the paramter is write only. SparForte can create a new variable
automatically (if this feature has not been disabled by the user).
-
in out - the parameter is read and changed by the command. The
variable must exist. This is the same as call-by-reference in
languages like C/C++/Java.
-
return value - the type of value returned for functions.
An Example
n := strings.length( s )
|
Return the number of characters in the string. Returns zero if the string is empty. |
Example |
n := strings.length( "bounce" ); -- retuns 6 |
Parameters |
Param |
Mode |
Type |
Default |
Description |
s |
in |
universal_string |
required |
the string to count |
n |
return value |
natural |
required |
the number of characters |
|
Exceptions |
- |
See Also |
- |
Compare With |
Ada: Ada.Strings.Unbounded.Length PHP: strlen |
This example uses the description of the strings.length function. Here is
how to read the description.
"n := strings.length( s )" shows the syntax of the function...often this
is all you need to look at to remind yourself of how to use the function.
Following this is a summary of what the function does, including an
example. If this is a GCC Ada function, the full name of the Ada function
appears in the "Ada Equivalent" section. This is to help you move your SparForte
scripts to other Ada-based tools and languages.
There is a detailed list of parameters. In the case of
strings.length, there is one parameter. It is an "in" parameter and it is
required (there is no default value for the parameter). The parameter is a
universal_string type (any kind of string variable).
strings.length returns a natural value (a zero or positive integer) which is
the number of characters in the string.
Additional Headings
There may be additional sections such as:
- See Also: names of similar or related subprograms
- Compare With: names of similar functions in other popular languages
- Exceptions: conditions for or names of exceptions which may be raised
- Restrictions: pragmas that may prevent this subprogram from executing
- Rationale: notes on how or why the subprogram was designed the way that it is
- Implementation Note: notes on unusual behaviour caused by the way a subprogram was built
|