/
packages.html
353 lines (284 loc) · 15.5 KB
/
packages.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="description" CONTENT="SparForte language documentation">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SparForte - Packages - Summary</title>
<link rel="StyleSheet" type="text/css" media="screen" href="art/sparforte.css">
<link rel="index" href="index.html" />
<link rel="next" href="pkg_arrays.html" />
</head>
<body bgcolor="#FFFFFF"><a name="top"></a>
<table width="100%" cellspacing="0" cellpadding="0" summary="page layout">
<tr><td align="left"><img src="art/sparforte.png" alt="[SparForte]"></td><td align="right"><img src="art/header_cloud.png" alt="[Banner]"></td></tr>
<tr><td background="art/header_border.png" height="10" colspan="2"></td></tr>
<tr><td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0" summary="top menu">
<tr>
<td width="10"><img src="art/menu_left.png" alt="[Top Main Menu]"></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="intro_preface.html">Intro</a></td>
<td background="art/menu_border.png" align="center"><span class="menutext">|</span></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="tutorial_1.html">Tutorials</a></td>
<td background="art/menu_border.png" align="center"><span class="menutext">|</span></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="ref_adascript.html">Reference</a></td>
<td background="art/menu_border.png" align="center"><span class="menutext">|</span></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="packages.html"><b>Packages</b></a></td>
<td background="art/menu_border.png" align="center"><span class="menutext">|</span></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="../examples/index.html">Examples</a></td>
<td background="art/menu_border.png" align="center"><span class="menutext">|</span></td>
<td width="85" background="art/menu_border.png" align="center"><a class="menutext" href="cont_vision.html">Contributors</a></td>
<td background="art/menu_border.png" align="center"> </td>
<td background="art/menu_border.png" align="right"><a href="ref_php.html"><img src="art/left_arrow.png" width="27" height="24" alt="[Back Page]" border="0"></a><span class="menutext"> </span><a href="pkg_arrays.html"><img src="art/right_arrow.png" width="27" height="24" alt="[Next Page]" border="0"></a></td>
<td background="art/menu_border.png"> </td>
</tr></table></td></tr>
</table>
<noscript>
<a href="#submenu">[Jump to Submenu]</a>
<hr />
</noscript>
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="content and right submenu">
<tr>
<td align="left" valign="top">
<!-- Content Area -->
<h2><a NAME="4.1"></a>Package Summary</h2>
<img class="padded_right" src="pictures/ryu_sheng_long.jpg" width="192" height="153" alt="[Ryu and Ken]" \>
<p>AdaScript contains hundreds of built-in constants, variables, functions and
procedures. Many of these are grouped into collections called packages.</p>
<h3>Built-in Packages</h3>
<p>AdaScript includes the following packages:
<ul>
<li>
<b>arrays</b> - contains general array operations</li>
<li>
<b>btree_io</b> - Berkeley DB B-Tree files</li>
<li>
<b>calendar</b> - contains time operations</li>
<li>
<b>cgi</b> - CGI variables and HTML cookie handling</li>
<li>
<b>chains</b> - contains information on the current chain</li>
<li>
<b>command_line</b> - the script name, parameters and return value</li>
<li>
<b>db</b> - PostgreSQL database interface</li>
<li>
<b>dbm</b> - PostgreSQL database (multiple connections) interface</li>
<li>
<b>directory_operations</b> - manage directories</li>
<li>
<b>doubly_linked_lists</b> - contains linked list operations</li>
<li>
<b>dynamic_hash_tables</b> - contains hash table operations</li>
<li>
<b>enums</b> - contains general enumerated type operations</li>
<li>
<b>exceptions</b> - contains exception handling operations</li>
<li>
<b>files</b> - contains general file and directory operations</li>
<li>
<b>gnat.cgi</b> - contains GNAT.CGI functions</li>
<li>
<b>gnat.crc32</b> - cyclic redundancy check calculator</li>
<li>
<b>hash_io</b> - Berkeley DB Hash files</li>
<li>
<b>hashed_maps</b> - key-value tables</li>
<li>
<b>l10n</b> - localization</li>
<li>
<b>lock_files</b> - create and destroy lock files</li>
<li>
<b>logs</b> - create simple log files</li>
<li>
<b>memcache</b> - memcache network cache interface</li>
<li>
<b>memcache.highread</b> - memcache network cache interface - high reading / high redundancy</li>
<li>
<b>mysql</b> - MySQL database interface</li>
<li>
<b>mysqlm</b> - MySQL multiple connections database interface</li>
<li>
<b>numerics</b> - contains mathematical functions and constants</li>
<li>
<b>os</b> - miscellaneous operating system functions</li>
<li>
<b>pen</b> - graphics, drawing and animation</li>
<li>
<b>pen (OpenGL)</b> - OpenGL bindings for pen package</li>
<li>
<b>records</b> - contains general record operations</li>
<li>
<b>sound</b> - play sounds, music or adjust the system mixer</li>
<li>
<b>source_info</b> - the script file name and current statistics</li>
<li>
<b>stats</b> - statistics on numeric arrays</li>
<li>
<b>strings</b> - contains string operations</li>
<li>
<b>System</b> - contains information about the computer a script is running</li>
<li>
<b>teams</b> - the development team</li>
<li>
<b>templates</b> - additional capabilities for templates</li>
<li>
<b>text_io</b> - console and text file input and output</li>
<li>
<b>units</b> - conversion between common measurements</li>
<li>
<b>vectors</b> - dynamic arrays</li>
</ul>
<p>These packages are referenced by name and are described in detail later
in this guide.</p>
<h3>Using Built-in Package Subprograms</h3>
<p>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".
<p><tt>=> ? strings.length( "PegaSoft" )</tt>
<br><tt>8</tt>
<p>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.</p>
<h3>Parameter Types</h3>
<p>Parameters to a command have a mode which determine how the parameter
is treated:</p>
<ul>
<li>
<b>in</b> - the parameter is read only. This is not the same as C/C++/Java's
<i>call-by-value</i> because an in parameter is a constant and the value
cannot be changed.</li>
<li>
<b>out</b> - the paramter is write only. SparForte can create a new variable
automatically (if this feature has not been disabled by the user).</li>
<li>
<b>in out</b> - the parameter is read and changed by the command. The
variable must exist. This is the same as <i>call-by-reference</i> in
languages like C/C++/Java.</li>
<li>
<b>return value</b> - the type of value returned for functions.</li>
</ul>
<h3>An Example</h3>
<h4>n := strings.length( s )</h4>
<table cellspacing="0" cellpadding="0" width="98%" summary="package call">
<tr>
<td width="15%"> </td>
<td><p>Return the number of characters in the string. Returns zero if the string is empty.</p></td>
</tr><tr>
<td><p class="pkg_label">Example</p></td>
<td><span class="code">n := strings.length( "bounce" ); -- retuns 6</span></td>
</tr><tr>
<td><p class="pkg_label">Parameters</p></td>
<td><table CELLSPACING=0 CELLPADDING=0 WIDTH="100%" border="0" >
<tr>
<td><span class="pkg_param">Param</span></td>
<td><span class="pkg_param">Mode</span></td>
<td><span class="pkg_param">Type</span></td>
<td><span class="pkg_param">Default</span></td>
<td><span class="pkg_param">Description</span></td>
</tr><tr>
<td><span>s</span></td>
<td><span>in</span></td>
<td><span>universal_string</span></td>
<td><span>required</span></td>
<td><span>the string to count</span></td>
</tr>
<tr>
<td><span>n</span></td>
<td><span>return value</span></td>
<td><span>natural</span></td>
<td><span>required</span></td>
<td><span>the number of characters</span></td>
</tr>
</table></td>
</tr><tr>
<td><p class="pkg_label">Exceptions</p></td>
<td><p>-</p></td>
</tr><tr>
<td><p class="pkg_label">See Also</p></td>
<td><p>-</p></td>
</tr><tr>
<td><p class="pkg_label">Compare With</p></td>
<td><p>Ada: Ada.Strings.Unbounded.Length<br>PHP: strlen</p></td>
</tr>
</table>
<hr>
<p>This example uses the description of the strings.length function. Here is
how to read the description.</p>
<p>"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.</p>
<p>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.</p>
<p>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).</p>
<p>strings.length returns a natural value (a zero or positive integer) which is
the number of characters in the string.</p>
<h3>Additional Headings</h3>
<p>There may be additional sections such as:</p>
<ul>
<li>See Also: names of similar or related subprograms</li>
<li>Compare With: names of similar functions in other popular languages</li>
<li>Exceptions: conditions for or names of exceptions which may be raised</li>
<li>Restrictions: pragmas that may prevent this subprogram from executing</li>
<li>Rationale: notes on how or why the subprogram was designed the way that it is</li>
<li>Implementation Note: notes on unusual behaviour caused by the way a subprogram was built</li>
</ul>
<br>
</td>
<td bgcolor="#d3c7f8" width="150" align="right" valign="top"><noscript><hr /></noscript><img src="art/right_menu_top.png" width="150" height="24" alt="[Right Submenu]"><br><a name="submenu"></a>
<p class="rmt"><a class="rightmenutext" href="packages.html"> <b>Summary</b></a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_arrays.html"> arrays</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_btree_io.html"> btree_io</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_calendar.html"> calendar</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_cgi.html"> cgi</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_chains.html"> chains</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_cmdline.html"> command_line</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_db.html"> db/ postgresql</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_dbm.html"> dbm</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_dirops.html"> directory_operations</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_doubly.html"> doubly_linked...</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_dht.html"> dynamic_hash_...</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_enums.html"> enums</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_exceptions.html"> exceptions</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_files.html"> files</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_gnat_cgi.html"> gnat.cgi</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_gnat_crc32.html"> gnat.crc32</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_hash_io.html"> hash_io</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_hmaps.html"> hashed_maps</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_l10n.html"> l10n</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_lock_files.html"> lock_files</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_logs.html"> logs</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_memcache.html"> memcache</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_memcache_highread.html"> memcache.highread</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_mysql.html"> mysql</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_mysqlm.html"> mysqlm</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_numerics.html"> numerics</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_os.html"> os</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_pen.html"> pen</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_pengl.html"> pen (OpenGL)</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_records.html"> records</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_sound.html"> sound</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_sinfo.html"> source_info</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_stats.html"> stats</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_strings.html"> strings</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_system.html"> System</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_teams.html"> teams</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_templates.html"> templates</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_text_io.html"> text_io</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_units.html"> units</a></p>
<p class="rmt"><a class="rightmenutext" href="pkg_vectors.html"> vectors</a></p>
</a></p>
</td>
</tr>
<tr>
<td bgcolor="#d3c7f8" align="left" valign="middle"><a href="#top"><img src="art/up_arrow.png" border="0" width="24" height="27" alt="[Back to Top]"><span> Back To Top</span></a></td>
<td bgcolor="#d3c7f8" align="center" valign="middle"><img src="art/forte_small.png" width="26" height="32" border="0" alt="[Small Forte Symbol]"></td>
</tr>
</table>
</body>
</html>
<p class="rmt"><a class="rightmenutext" href="pkg_vectors.html"> vectors</a></p>