AdaScript contains hundreds of built-in constants, variables, functions and procedures. Many of these are grouped into collections called packages.
AdaScript includes the following packages:
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" )
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.
Parameters to a command have a mode which determine how the parameter is treated:
n := strings.length( s )
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.
Finally, 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.
|Back To Top|