3 Read in 'tokens' and braces and save into tree structure.
4 Actually there is no "pre-compiling" done as stated in the
5 original Installer docs.
11 is an integer of type (long int)
12 Its representation is a decimal number or
13 $xxx will be considered as HEX and
14 %xxxx as binary numbers.
15 Boolean arguments are 0 for FALSE and non-0 for TRUE.
16 Boolean functions return 1 as TRUE.
19 is a quoted ("..." or '...') string
21 Arguments without quotes are considered to be variables
22 Variables are typeless and converted to the functions needs
23 (exception is ( <format-string> <arguments>... ) where the variable
24 is checked for a non-NULL string or the integer value will be
25 used which will be 0 for unset variables
27 and therefore being exchanged by their values at runtime
28 ( <string> is converted via atol( <string> );
29 <int> is converted via sprintf( string, "%ld", <int> );
31 Unset variables are NULL in string and 0 in integer value.
32 Commands can be used as arguments, too, as the return value
34 Example: ( set sum ( + a b ) )
39 Arguments in [...] are optional.
42 Blocks. If the first argument in brackets is a command (...) all
43 others have to be commands, too.
44 The return value is the return value of the last command in the block.
45 Empty blocks are not allowed.
47 If a command is not recognized an error SCRIPTERROR is produced.
50 ( abort [<string>...] )
51 Shows strings and executes trap or onerror statements if present and
53 This function never returns.
59 ( bitand <int> <int> )
61 ( bitxor <int> <int> )
70 ( shiftleft <int> <int> )
71 ( shiftrght <int> <int> )
72 These functions return the result of the operations on the two integers.
73 For logical operations 1 is returned as TRUE and 0 as FALSE.
74 ( / <int> <int> ) checks 2nd arg == zero and produces an error BADPARAMETER.
78 Concatenates all args as strings. This function was intended to be the only
79 valid function for converting <int> to <string>
80 (Well, except ( "..." ... ), too )
81 The return value is the quoted string.
85 Tells the user how much ( in percent ) is already done.
86 The return value is the percentage.
87 NOTE: We do not check for percentage < 0 or > 100 !!!
91 If run from Shell and DEBUG was specified in the command line
92 the arguments (strings, integers, variables) will be printf()'ed
93 to the shell separated by spaces.
94 The return value is the quoted string of all concatenated arguments.
97 ( exit [(quiet)] [<string>...] )
98 Shows the strings separated by a linefeed and exits normally.
99 A summarizing message with information on where the app was installed
100 and the log-file can be found will be displayed unless (quiet) is
101 specified as a parameter.
102 This function never returns.
105 ( if <int> <then> [<else>] )
106 <int> is checked for !=0 and returns <then> otherwise <else> or 0 if
107 <else> is left out. If <then> is a string and <else> is omitted this
108 function returns an empty string as the false value.
109 <int>, <then> and <else> may be functions, too.
112 ( in <base-int> <bit-int>... )
113 This function returns <base-int>'s bits given in <bit-int>... (mask).
118 Returns logical/bitwise negation of argument.
122 Returns the sum of all integers, 0 for no arguments.
126 Returns the product of all integers. Needs at least one <int>
129 ( procedure <name> [<arg>...] (...) )
130 Procedures are defined during parsing. The name has to be a non-quoted
131 string which must not begin with digits. Consider using a prefix like
132 "P_" for your procedures to avoid a conflict with future extensions of
134 <arg>... is an optional list of variables which will be set when calling
135 the procedure. However, you can call the procedure with less than the
136 specified arguments; in this case the unset variables retain their old
137 values (example from original Installer docs):
138 ( procedure P_ADDMUL arg1 arg2 arg3
139 ( * ( + arg1 arg2 ) arg3 )
141 ( message ( P_ADDMUL 1 2 3 ) ) ; shows 9
142 ( message ( P_ADDMUL 4 5 ) ) ; shows 27, arg3 stays the same
144 Note that there are no local variables, so that a call
147 ( set arg1 1 arg2 2 arg3 3 )
150 Though the ( procedure ... ) command is ignored at run-time it returns 0.
153 ( select <int> [<any>...] )
154 Returns the value of the <int>th <any>-item or 0 if <int> < 1 or
155 <int> > number of <any>.
159 Returns the length of <string> or 0 if argument is an integer.
162 ( until <int> (...) )
163 Executes the block (post-checked) until <int> statement is TRUE.
164 Returns the (last) value of the executed block.
167 ( while <int> (...) )
168 Executes the block (pre-checked) while <int> statement is TRUE.
169 Returns the (last) value of the executed block or 0 if block has
173 ( set <var-name> <value> ... )
174 Use (set ...) to set variables.
175 Variable names have to be unquoted strings -- commands are not accepted
176 Values can be anything.
177 Consider using a prefix like '#' to avoid conflicts with future versions
178 of Installer. The prefix '@' is reserved for internal variables. They
179 can be set to other values, too.
182 ( symbolset <var-name> <value> ... )
183 With this functions you can use quoted strings as varnames (quotes will be
184 stripped). This allows to have "dynamic" variables like ( "var%ld" n )
185 Therefore commands as varnames will be executed.
186 NOTE: sole integers as variables are not allowed, though ( "1" ) will
187 work, but is not recommended to use.
190 ( symbolval <var-name> )
191 Use this functions to have access to "dynamic" variables set with
193 Same naming conventions as in symbolset apply here.
196 ( askbool [( help <string>... )]
197 [( prompt <string>... )]
199 [( choices <yesstring> [<nostring>] )]
201 Asks the user to select yes or no unless user is NOVICE
202 (ie. @user-level = 0 ). Returns 0 for "No" and 1 for "Yes".
203 Defaults to 0 = "No".
206 ( asknumber [( help <string>... )]
207 [( prompt <string>... )]
209 [( range <min-int> <maxint>] )]
211 Asks the user for a number unless user is NOVICE (ie. @user-level = 0 ).
213 range defaults to non-negative numbers, unless default is negative which
214 causes range to be extended to include the default number.
217 ( askstring [( help <string>... )]
218 [( prompt <string>... )]
221 Asks the user for a string unless user is NOVICE (ie. @user-level = 0 ).
225 ( askchoice [( help <string>... )]
226 [( prompt <string>... )]
228 ( choices <string>... )
230 Asks the user to select one item out of N unless user is NOVICE
231 (ie. @user-level = 0 ).
233 choices is list of strings listed as items of the requester
234 NULL strings will not be displayed.
235 The Return value is the number of the selected item, starting with 0 as
238 NOTE: Original Installer docs read:
239 >> return value is a bitmask [...] maximum of 32 items.
240 Tests showed that the number is passed - not a bitmask, but choices are
241 nevertheless limited to 32!
243 >> NOTE: "<ESC>[2p" sequence at beginning of one item leads to
244 >> proportional rendering (>V42)
245 This is not implemented now!
248 ( <format-string> <argument>... )
249 This construct works like C printf() and returns the resulting string
250 after substituting '%d' and '%s'. An 'sprintf(var,"format", args... )'
251 can be achieved by '( set var ( "format" <args>... ) )'
252 Installer uses RawDoFmt() and does not check correctness of arguments.
255 ( substr <string> <start> [<count>] )
256 Returns the substring of <string>, beginning with offset <start>
257 (offset 0 is the first character) and including <count> characters.
258 If <count> is omitted, then the rest of the string is returned.
261 ( transcript [<string>...] )
262 Concatenates all strings writes them to the logfile and appends a
264 Returns the concatenated strings.
267 ( user <int>|<"novice"|"average"|"expert"> )
268 Changes the user level (@user-level) to the given value.
269 Specify an integer 0 = novice 1 = average 2 = expert or the (quoted)
270 strings "novice" "average" or "expert"
271 Use this function only to debug your own scripts. In official releases
272 this function shouldn't appear.
273 Returns the new user-level.
276 ( welcome <string>... )
277 Displays the strings instead of
278 "Welcome to <APPNAME> App installation utility."
279 and asks for the user level.
280 Without this function appearing in the script the user level is requested
281 straight at the beginning.
284 ( message <string>...
285 [(help <string>... )]
288 Displays the strings and offers "Proceed", "Abort" and "Help" buttons.
289 The message is not displayed in NOVICE mode unless (all) is specified.
290 Please, do not confuse the novice user.
293 ( working <string>... )
294 Displays the concatenated strings under a standard line reading
295 "Working on Installation". This can be used to tell the user what's
296 going on when doing long operations except copying which has its own
303 Execute an AmigaDOS script.
307 [(prompt <string>... )]
308 [(help <string>... )]
312 This function returns the primary result of the called program and
313 the secondary is passed in '@ioerr'.
317 # tests with original Installer showed:
318 # ( append )s are collected
319 # ( include )s are replaced, i.e. only the last ( include ) is taken
320 # first (append)s are printed then last (include)
321 ## Distinguish between overriding and appending parameters and introduce
322 ## according functions to collect args. Or always append/collect as multiple
323 ## strings and let function behave as desired.
327 /* Ask user for a directory */
331 /* Ask user insert a disk */
335 /* Ask user for a file */
339 /* Ask user to choose multiple items */
342 ( database <feature> )
343 /* Return information on the hardware Installer is running on */
347 -> "68000" "68010" "68020" "68030" "68040" "68060"
349 "Pentium" "PentiumPro" "Celeron" "PentiumII" "PentiumIII"
350 "K6" "K6-II" "K6-III" "Athlon"
352 -> Size of free CHIP RAM (via AvailMem(MEMF_CHIP))
354 -> Total size of free RAM (via AvailMem(MEMF_TOTAL))
356 -> "68881" "68882" "FPU40" "80387" "80486" "NOFPU"
358 -> "AA" "ECS" "AGNUS" "VGA"
359 Return-type is always a string except for free RAM size.
363 Use this function to define code to be executed after an error occurred.
364 This can be used to delete installed stuff if an error occurs or user
365 aborted installation. This function is mutually exclusive with trap command.
368 ( trap <trapflag> (...) )
369 Use this function to set an error handling routine.
370 When an error occurs and ( trap ... ) has been set before, the statements
371 of the trap command are executed. Use this to clean up if an abnormal
372 termination of the script occurs. If no trap is set for a specific errorcode
373 the more general ( onerror ... ) statements are executed if declared before.
376 2 := Ran out of memory
378 4 := DOS error (more infos in @ioerr , see below )
379 5 := Bad parameter data
382 ( startup <name-string>
383 [(prompt <string>... )]
384 [(help <string>... )]
386 (command <string>... )
394 into S:User-Startup. If a section with this name already exists the section
395 will be replaced by this new one.
396 The commands between the markers are given in (command ...).
397 The user will only be prompted to confirm this action if in Expert mode.
401 [(prompt <string>... )]
402 [(help <string>... )]
404 [(optional <option>... )]
405 [(delopts <option>... )]
409 Delete a file. (only plain deletion is implemented by now!)
411 force - unprotect file
412 askuser - ask user if file should be unprotected,
413 in novice the automatic answer is "no"
419 Checks if a <name> exists.
420 Returns 0 if non-existent, 1 for a file or 2 for a directory.
421 If (noreq) is specified, then no requester will pop up if
422 <name> should be on a not-mounted volume.
426 [(prompt <string>... )]
427 [(help <string>... )]
433 (infos) creates also an icon for the new directory (not yet implemented).
436 ( rename <oldname> <newname>
437 [(prompt <string>... )]
438 [(help <string>... )]
443 Renames the file "oldname" to "newname". If the parameter (disk) is
444 passed, then this command relabels the disk "oldname" to "newname".
445 When relabeling disks *only* include a colon ":" in the oldname.
446 The function proceeds silently unless (confirm) is passed where the
447 (prompt) is shown and (help) is available. If (safe) is passed then
448 the renaming will be done even when in PRETEND mode.
449 This function returns 1 on success and 0 on failure.
452 ( fileonly <pathname> )
453 Returns the file part of <pathname>.
455 (fileonly "A:BC/def/gh") -> "gh"
458 ( pathonly <pathname> )
459 Returns the path part of <pathname>.
461 (pathonly "A:BC/def/gh") -> "A:BC/def"
464 ( earlier <file1> <file2> )
465 Returns TRUE if file1 is older (earlier) than file2.
468 ( getdiskspace <pathname> )
469 Returns the number free bytes on the device. If the pathname is bad or
470 no info could not be obtained, -1 is returned.
474 Returns the value of an ENV: variable (through DOS/GetVar(name,...))
478 Returns the size of file <name> in bytes or 0 if file does not exist.
481 ( makeassign <assign> [<path>]
484 Assigns assign to path. If path is not specified, the assign is removed.
485 If (safe) is passed then the assign will be done even when in PRETEND mode.
486 Returns 1 on success and 0 on failure.
489 ( getassign <name> [<option>])
490 Returns the path of <name>. The default is to return the logical assignments.
491 <Option> can be one of:
492 'a': match logical assignments only (default)
493 'v': match volumes only
494 'd': match devices only
496 If <name> does not exist as the specified type, an empty string is returned.
498 Note that you must specify the device/volume/assign without the trailing
499 colon. The return value will be a true path, ie. with the colon.
500 If <option> is device and <name> is a device, its volume name is reported,
501 unless it doesn't exist in which case the device name is returned.
505 Returns the volume name on which <path> exists or an empty string if
506 <path> does not exist.
509 ( tackon <path> <file> )
510 Returns the combined pathname of <path>+<file>.
512 NOTE: Currently DOS.library/AddPart() cannot cope with a leading '/' in the
516 ( expandpath <path> )
517 Expands the <path>. For example "C:Mount" will become "System:C/Mount"
520 /* Unimplemented commands */
531 /* Here are all tags, first the ones which have to be executed */
534 /* unset copying/deleting options if we are called global */
535 /* as parameter to a function we have got an ignore=1 before */
539 /* These may be combined in any way */
544 /* set copying/deleting options if we are called global */
545 /* as parameter to a function we have got an ignore=1 before */
549 /* These may be combined in any way */