avram.1 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. .\" hey, Emacs: -*- nroff -*-
  2. .\" avram is free software; you can redistribute it and/or modify
  3. .\" it under the terms of the GNU General Public License as published by
  4. .\" the Free Software Foundation; either version 2 of the License, or
  5. .\" (at your option) any later version.
  6. .\"
  7. .\" This program is distributed in the hope that it will be useful,
  8. .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. .\" GNU General Public License for more details.
  11. .\"
  12. .\" You should have received a copy of the GNU General Public License
  13. .\" along with this program; see the file COPYING. If not, write to
  14. .\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  15. .\"
  16. .TH AVRAM 1 "January 31, 2007"
  17. .\" Please update the above date whenever this man page is modified.
  18. .\"
  19. .\" Some roff macros, for reference:
  20. .\" .nh disable hyphenation
  21. .\" .hy enable hyphenation
  22. .\" .ad l left justify
  23. .\" .ad b justify to both left and right margins (default)
  24. .\" .nf disable filling
  25. .\" .fi enable filling
  26. .\" .br insert line break
  27. .\" .sp <n> insert n+1 empty lines
  28. .\" for manpage-specific macros, see man(7)
  29. .SH NAME
  30. avram \- Applicative ViRtuAl Machine
  31. .SH SYNOPSIS
  32. .nf
  33. \fBavram\fP [general options]
  34. .br
  35. \fBavram\fP [filter mode options] codefile[.avm] < inputfile
  36. .br
  37. \fBavram\fP [parameter mode options] codefile[.avm] [parameters]
  38. .fi
  39. .SH DESCRIPTION
  40. \fBavram\fP is a virtual machine code interpreter. It reads an input
  41. file containing an application written in virtual machine code, and
  42. executes it on the host machine. The virtual machine code normally will
  43. have been translated from a high level language by a compiler, allowing
  44. \fBavram\fP to be independent of the source language.
  45. .PP
  46. In theory, virtual machine programs are more easily
  47. portable than those in native code because they run without
  48. modification on any platform to which the interpreter has been
  49. ported. Virtual machines may also simplify the job of a compiler
  50. writer by providing more direct support for high level language
  51. features than is possible or appropriate for real hardware.
  52. .PP
  53. The virtual code format used by \fBavram\fP is designed to
  54. support the features of functional or applicative programming
  55. languages. This manpage documents only the usage of \fBavram\fP
  56. and not the internals, but it will be helpful in what follows to keep
  57. in mind that the virtual machine code expresses a mathematical
  58. function rather than a program in the conventional sense. As such, it
  59. performs no action directly, but may be applied in a choice of ways by
  60. the user of \fBavram\fP according to the precise operation required.
  61. .SH GENERAL OPTIONS
  62. Regardless of whatever other command line parameters are given,
  63. \fBavram\fP accepts the following parameters:
  64. .TP
  65. .B -h, --help
  66. Show a summary of options and exit.
  67. .TP
  68. .B -V,-v, --version
  69. Show the version of program and a short copyleft message and exit.
  70. .TP
  71. .B --emulation=\fIversion\fP
  72. Be backward compatible with an older version of \fBavram\fP. This
  73. option should include a valid version number, for example
  74. 0.1.0, which is the version of \fBavram\fP to be
  75. emulated. It can make virtual code applications future proof, assuming
  76. that future versions of \fBavram\fP correctly support backward
  77. compatibility. It may be used in conjunction with any other option in
  78. any mode of operation.
  79. This copy of the manpage has not been updated since version 0.7.0 of
  80. \fBavram\fP, so it is unable to document incompatibilities with later
  81. versions. The latest version of the manual may be found at
  82. \fBhttp://www.basis.uklinux.net/avram\fP.
  83. .TP
  84. .B -e, --external-libraries
  85. Show a list of libraries with which \fBavram\fP has been linked and
  86. whose functions therefore could be called from virtual machine
  87. programs. This growing list currently includes selected functions from
  88. fftw, glpk, gsl, lapack, minpack, mpfr, pcx, rmath, umf, and
  89. kinsol which are documented further in the \fBavram\fP reference manual.
  90. .TP
  91. .B -j, --jail
  92. This option disables execution of shell commands by virtual code
  93. applications, which is normally possible by default even for nominally
  94. non-interactive applications (see below). A virtual code application
  95. attempting to spawn a shell (using the interact combinator) when this
  96. option is selected will encounter an exception rather than successful
  97. completion of the operation. This option is provided as a security
  98. feature for running untrusted code, and is incompatible with \fB-i\fP,
  99. \fB-t\fP, and \fB-s\fP.
  100. .TP
  101. .B -f, --force-text-input
  102. Normally \fBavram\fP will try to guess by looking at a file whether it
  103. is an ordinary text file or one that has been written in the virtual
  104. code file format, and choose a different internal representation
  105. accordingly. An application may require one representation or the
  106. other. This option tells \fBavram\fP to treat all input files other
  107. than the virtual code file as text files regardless of whether or not it
  108. would be possible to interpret them otherwise. This option may be used
  109. in combination with any other option.
  110. .SH MODES OF OPERATION
  111. Apart from to the capability to print brief help messages and exit,
  112. there are two main modes of operation, depending on which options
  113. are specified.
  114. .TP
  115. .B Filter mode
  116. In filter mode, the argument to the function given by the virtual code
  117. is taken from standard input, and the result is written to standard
  118. output, except for error messages resulting from a failure to evaluate
  119. the function, which are written to standard error. Filter mode is
  120. indicated whenever these three conditions are all met.
  121. .RS
  122. .TP
  123. *
  124. Either at least one of the filter mode options listed below appears
  125. on the command line preceding the first filename parameter, or there
  126. are no options at all.
  127. .TP
  128. *
  129. Exactly one filename parameter appears on the command line,
  130. which is the name of the virtual machine code file.
  131. .TP
  132. *
  133. Either the filename comes last on the command line, or the
  134. \fB--unparameterized\fP option precedes it, causing
  135. everything following it to be ignored.
  136. .RE
  137. .TP
  138. .B Parameter mode
  139. In parameter mode, the argument to the function given by the virtual
  140. code is a data structure containing environment variables and command
  141. line parameters including files, application specific options, and
  142. possibly standard input. The result obtained by evaluating the
  143. function is either a data structure representing a set of files to be
  144. written, which may include standard output, or a sequence of shell
  145. commands to be executed, or a combination of both. Parameter mode is
  146. indicated whenever either of these conditions is met.
  147. .RS
  148. .TP
  149. *
  150. Any of the parameter mode options listed below appears on the
  151. command line preceding the first filename parameter.
  152. .TP
  153. *
  154. At least one additional filename parameter or option follows the first one,
  155. and the \fB--unparameterized\fP option is not selected.
  156. .RE
  157. .P
  158. For the purpose of choosing the mode of operation, the virtual
  159. code filename is taken to be the first command line argument not
  160. beginning with a dash. Other conventions relevant to application
  161. specific parameters are detailed below.
  162. .SH FILTER MODE OPTIONS
  163. The options available in filter mode are listed below. Except as
  164. otherwise noted, all options are mutually exclusive. Ordinarily a
  165. given application will require certain fixed settings of these options
  166. and will not work properly if they are set inappropriately.
  167. .TP
  168. .B -r, --raw-output
  169. Normally the result obtained by evaluating the function in the virtual
  170. code file must be a list of character strings, which is written as
  171. such to standard output. However, if this option is selected, the form
  172. of the result is unconstrained, and it will be written in a data file
  173. format that is not human readable but can be used by other
  174. applications. This option is incompatible with any other options
  175. except \fB-u\fP.
  176. .TP
  177. .B -c, --choice-of-output
  178. When this option is used, the evaluation of the function given by the
  179. virtual machine code will be expected to yield a data structure from
  180. which \fBavram\fP will ascertain whether standard output should be
  181. written in text or raw data format. This option should be used only
  182. if application is aware of it. It is incompatible with any other options
  183. except \fB-u\fP.
  184. .TP
  185. .B -l, --line-map
  186. Normally the entire contents of standard input up to EOF are loaded
  187. into memory and used as the argument to the function in the virtual
  188. code file. However, this option causes standard input to be read a
  189. line at a time, with the function applied individually to each line in
  190. sequence, and its result in each case written to standard output as
  191. soon as it is computed. A given application either requires this
  192. option or does not, and will not work properly in the
  193. alternative. This option implies \fB-f\fP and is incompatible with any
  194. other option except \fB-u\fP.
  195. .TP
  196. .B -b, --byte-transducer
  197. This option causes standard input to be read one character at a time,
  198. evaluating the function given by the virtual code file each time. The
  199. function is used as a state transition function that takes a state and
  200. input to a next state and output. The output is expected to be a
  201. character string and is written concurrently with the input
  202. operations. A given application will not work properly with an
  203. inappropriate setting of this option. This option implies \fB-f\fP
  204. and is incompatible with any other option except \fB-u\fP.
  205. .TP
  206. .B -u, --unparameterized
  207. Normally \fBavram\fP guesses whether to use filter mode or parameter
  208. mode depending on whether there are any parameters. Selecting this
  209. option forces it to operate in filter mode regardless. Any parameters
  210. that may appear on the command line after the virtual code file name
  211. are ignored. This option may be used in conjunction with any other
  212. filter mode option.
  213. .SH PARAMETER MODE OPTIONS
  214. The parameter mode options are listed below. Except as otherwise
  215. noted, any combination of parameter mode options may be selected
  216. together, and except as noted, the settings of these options can be
  217. varied without breaking the application.
  218. .TP
  219. .B -q, --quiet
  220. \fBavram\fP normally informs the user when writing an output file with
  221. a short message to standard output. This option suppresses such
  222. messages. This option is compatible with any application and any other
  223. parameter mode option except \fB-a\fP.
  224. .TP
  225. .B -a, --ask-to-overwrite
  226. Selecting this option will cause \fBavram\fP to ask permission
  227. interactively before overwriting an existing file, and to refrain from
  228. overwriting it without permission, in which case the contents that
  229. were to be written will be lost. This option overrides \fB-q\fP and is
  230. compatible with any other parameter mode option or application.
  231. .TP
  232. .B -.EXT
  233. An option beginning with a dash followed by a period specifies a
  234. default extension for input file names. If \fBavram\fP doesn't find a
  235. file named on the command line, and the filename doesn't already
  236. contain a period, \fBavram\fP will try to find a file having a similar
  237. name but with the default extension appended. The default extension given
  238. by this option takes precedence over the hard coded default extensions
  239. of .fun and .avm. At most one default extension can be supplied. This
  240. option is compatible with any other parameter mode option and
  241. compatible with any application.
  242. .TP
  243. .B -d, --default-to-stdin
  244. If no filename parameter appears on the command line (other than the
  245. name of the virtual code file), this option directs \fBavram\fP to
  246. read the contents of standard input as if it were specified as a
  247. command line parameter. (Standard input can also be specified
  248. explicitly as a dash.) This option is compatible with any application
  249. and any other parameter mode option except \fB-m\fP.
  250. .TP
  251. .B -m, --map-to-each-file
  252. Normally \fBavram\fP loads the entire contents of all files named on
  253. the command line into memory so as to evaluate the virtual machine
  254. code application on all of them together. This option can be used to
  255. save memory in the case of applications that operate on multiple files
  256. independently. It causes \fBavram\fP to load only one file at a time
  257. and to perform the relevant evaluation and output before loading the
  258. next one. Application specific options and standard input (if
  259. specified) are read only once and reused. This option is incompatible
  260. with \fB-d\fP, and not necessarily compatible with all applications,
  261. although some may work both with and without it.
  262. .TP
  263. .B -i, --interactive
  264. This option is used in the case of applications that interact with
  265. other programs through shell commands. An application that is meant to
  266. be invoked in this way requires this option and will not work without
  267. it, nor will applications that are not of this type work with it. This
  268. option is implied by \fB-t\fP and \fB-s\fP, and is compatible with any
  269. other parameter mode option.
  270. .TP
  271. .B -s, --step
  272. This option is used in the case of applications that interact with
  273. other programs through shell commands, similarly to \fB-i\fP, and can
  274. substitute for it (see above). The option has the additional effect of
  275. causing shell commands issued by \fBavram\fP on behalf of the
  276. application to be written with their results to standard output, and
  277. to cause \fBavram\fP to pause after displaying each shell command
  278. until a key is pressed. This capability may be useful for debugging
  279. or auditing purposes but does not otherwise alter the effects of the
  280. application. This option is compatible with any other parameter mode
  281. option.
  282. .TP
  283. .B -t, --trace
  284. This option is used in the case of applications that interact with
  285. other programs through shell commands, but only by way of the
  286. \fBinteract\fP combinator, for which it provides developers a means
  287. of low level debugging, particularly deadlock detection. When this
  288. option is selected, a verbose trace of all characters exchanged
  289. between the functional transducer and the external application are
  290. written to standard output, along with some additional control flow
  291. diagnostics. This option is compatible with any other parameter mode
  292. option.
  293. .TP
  294. .B -p, --parameterized
  295. Normally \fBavram\fP tries to guess whether to operate in filter mode
  296. or parameter mode based on the options used and the parameters. If
  297. there are no parameters and no options, it will default to filter
  298. mode, and try to read standard input. However, if this option is
  299. selected, it will use parameter mode (and therefore not try to read
  300. standard input unless required).
  301. .SH COMMAND LINE SYNTAX
  302. The command line parameters that follow the virtual code file name
  303. when \fBavram\fP is used in parameter mode are dependent on the
  304. specific application. However, all supported applications are
  305. constrained for implementation reasons to observe certain uniform
  306. conventions regarding their command line parameters, which are
  307. documented here to avoid needless duplication.
  308. .P
  309. The shell divides the command line into "arguments" separated by white
  310. space. Arguments containing white space or special characters used by
  311. the shell must be quoted or protected as usual. File names with wild
  312. cards in them are expanded by the shell before \fBavram\fP sees them.
  313. .P
  314. \fBavram\fP then extracts from the sequence of arguments a sequence of
  315. filenames and a sequence of options. Each option consists of a keyword and an
  316. optional parameter list. Filenames, keywords, and parameter lists are
  317. distinguished according to the following criteria.
  318. .TP
  319. 1.
  320. An argument is treated as a keyword iff it meets these three
  321. conditions.
  322. .RS
  323. .TP
  324. (a)
  325. It starts with a dash.
  326. .TP
  327. (b)
  328. It doesn't contain an equals sign.
  329. .TP
  330. (c)
  331. It doesn't consist solely of a dash.
  332. .RE
  333. .TP
  334. 2.
  335. An argument is treated as a parameter list iff it meets these four
  336. conditions.
  337. .RS
  338. .TP
  339. (a)
  340. It doesn't begin with a dash.
  341. .TP
  342. (b)
  343. It either begins with an equals sign or doesn't contain one.
  344. .TP
  345. (c)
  346. It immediately follows an argument beginning with a dash, not
  347. containing an equals sign, and not consisting solely of a dash.
  348. .TP
  349. (d)
  350. At least one of the following is true.
  351. .RS
  352. .TP
  353. 1)
  354. It doesn't contain a period, tilde, or path separator.
  355. .TP
  356. 2)
  357. It contains a comma.
  358. .TP
  359. 3)
  360. It can be interpreted as a C formatted floating point number.
  361. .RE
  362. .RE
  363. .TP
  364. 3.
  365. An argument is treated as an input file name iff it meets these four
  366. conditions.
  367. .RS
  368. .TP
  369. (a)
  370. It doesn't begin with a dash.
  371. .TP
  372. (b)
  373. It doesn't contain an equals sign.
  374. .TP
  375. (c)
  376. It doesn't contain a comma.
  377. .TP
  378. (d)
  379. At least one of the following is true.
  380. .RS
  381. .TP
  382. 1)
  383. It contains a period, tilde, or path separator.
  384. .TP
  385. 2)
  386. It doesn't immediately follow an argument beginning with a dash,
  387. not consisting solely of a dash, and not containing an equals sign.
  388. .RE
  389. .RE
  390. .TP
  391. 4.
  392. If an argument contains an equals sign but doesn't begin with one, the
  393. part on the left of the first equals sign is treated as a keyword and
  394. the part on the right is treated as a parameter list.
  395. .TP
  396. 5.
  397. An argument consisting solely of a dash is taken to represent the standard input file.
  398. .TP
  399. 6.
  400. An argument not fitting any of the above classifications is an error.
  401. .P
  402. These conventions are needed for \fBavram\fP to detect input file
  403. names in a general, position independent way, so that it can preload
  404. the files on behalf of the application. Many standard Unix utilities
  405. follow these conventions to a large extent, the exceptions being
  406. those that employ non-filename arguments without distinguishing
  407. syntax, and use positional or other ad hoc methods of command line
  408. interpretation. A drop-in replacement for such an application could
  409. nevertheless be implemented using \fBavram\fP with an appropriate
  410. wrapper script, similar to the approach recommended below, but with
  411. suitable keywords inserted prior to the ambiguous arguments.
  412. .RE
  413. .SH DIAGNOSTICS
  414. The means exists for virtual code applications to have run time error
  415. messages written to standard error on their behalf by
  416. \fBavram\fP. Any error messages not documented here originate with an
  417. application and should be documented by it.
  418. Most error messages originating from \fBavram\fP are prefaced by the
  419. application name (i.e., the name of the file containing the virtual
  420. machine code), but will be prefaced by \fBavram\fP: if the error is
  421. caused by a problem loading this file itself. Error
  422. messages originating from virtual machine code applications are the
  423. responsibility of their respective authors and might not be prefaced
  424. by the application name.
  425. The run time errors not specifically raised by the application can be
  426. classified as internal errors, i/o errors, overflow errors, file
  427. format errors, application programming errors, and configuration related
  428. errors.
  429. Some error messages include a code number. The number identifies
  430. the specific point in the source code where the condition was
  431. detected, for the benefit of the person maintaining it.
  432. .TP
  433. .B internal errors
  434. Internal errors should never occur unless the
  435. \fBavram\fP source code has been carelessly modified. There are two kinds.
  436. .RS
  437. .TP
  438. .B \fIapplication-name\fP: virtual machine internal error (code \fInn\fP)
  439. Most internal errors would be reported by a message of this form
  440. if they were to occur. It indicates that some required invariant was
  441. not maintained. In such cases, the program terminates immediately, and
  442. any results already produced are suspect.
  443. .TP
  444. .B \fIapplication-name\fP: \fInn\fP unreclaimed \fIstruct-names\fP
  445. A message of this form could be printed at the end of an otherwise successful
  446. run. \fBavram\fP maintains a count of the number of units allocated
  447. for various data structures, and checks that they are all reclaimed
  448. eventually as a safeguard against memory leaks. This message indicates
  449. that some memory remains unaccounted for.
  450. .RE
  451. .RS
  452. If a repeatable internal error is discovered, please email a bug
  453. report and a small representative test case to the address below.
  454. .RE
  455. .TP
  456. .B i/o errors
  457. These error messages are prefaced with the name of the
  458. application. A further explanation as to the
  459. reason, obtained from the standard \fBstrerror()\fP utility, is
  460. appended to the messages below if possible.
  461. .RS
  462. .TP
  463. .B \fIapplication-name\fP: can't read \fIfilename\fP
  464. A file was not able to be opened for reading, typically because it was
  465. not found or because the user does not have permission. The file name is
  466. displayed with special characters expanded but without any default
  467. extensions or search paths that may have been tried. If you think a file
  468. exists and should have been found, there may be a problem with your
  469. \fBAVMINPUTS\fP environment variable.
  470. .TP
  471. .B \fIapplication-name\fP: can't write \fIfilename\fP
  472. A file was not able to be opened for writing.
  473. .TP
  474. .B \fIapplication-name\fP: can't write to \fIfilename\fP
  475. A file was successfully opened for writing but became impossible to
  476. write thereafter.
  477. .TP
  478. .B \fIapplication-name\fP: can't spawn \fIcommand\fP
  479. An attempt to execute a shell command on behalf of an interactive
  480. application failed during the \fBexp_popen()\fP library call.
  481. .TP
  482. .B \fIapplication-name\fP: can't close \fIfilename\fP
  483. A call to the standard C procedure \fBfclose()\fP failed due to
  484. unforeseen circmstances. The error is non-fatal but the file should
  485. be checked for missing data.
  486. .RE
  487. .TP
  488. .B overflow errors
  489. These errors are reported by the application name prefacing one of the
  490. following messages, except as noted below.
  491. .RS
  492. .TP
  493. .B \fIapplication-name\fP: counter overflow (code \fInn\fP)
  494. An overflow occurred in an unsigned long integer being used as a reference
  495. counter or something similar. This situation is very unlikely.
  496. .TP
  497. .B \fIapplication-name\fP: memory overflow (code \fInn\fP)
  498. There wasn't enough memory to build an internal data structure. The
  499. most likely cause is an attempt to operate on input
  500. files that are too large. Standard remedies apply.
  501. .RE
  502. .RS
  503. The memory overflow or counter overflow messages can also be reported
  504. without the application name preface or a code number. In these cases,
  505. they arise in the course of evaluating the function given by the
  506. application, rather than by loading the input files.
  507. A counter overflow in this case is possible if the application
  508. attempts to compute the size of a very large, shared structure using
  509. native integer arithmetic.
  510. Memory overflows are possible due to insufficient memory for a valid
  511. purpose, but may also occur due to a non-terminating recursion in the
  512. virtual machine code. To prevent thrashing or other bad effects from
  513. runaway code, \fBulimit\fP is your friend.
  514. .RE
  515. .TP
  516. .B file format errors
  517. Certain application crashes result from an application not adhering
  518. to the required conventions about data and file formats, or because the
  519. application was invoked with inappropriate options (see above). These
  520. are the following.
  521. .RS
  522. .TP
  523. .B \fIapplication-name\fP: invalid text format (code \fInn\fP)
  524. An application that was expected to return a string of characters to
  525. be written to a text file returned data that did not correspond to any
  526. valid character representation.
  527. .TP
  528. .B \fIapplication-name\fP: null character in prompt
  529. An interactive application (invoked rightly or wrongly with \fB-i\fP,
  530. \fB-t\fP, or \fB-s\fP) is required to exchange strings of non-null
  531. characters internally with \fBavram\fP, and used a null.
  532. .TP
  533. .B \fIapplication-name\fP: invalid file name (code \fInn\fP)
  534. The data structure representing a file obtained from an application
  535. has a name consisting of something other than character strings. This
  536. error could be the result of a filter mode application being invoked
  537. in parameter mode.
  538. .TP
  539. .B \fIapplication-name\fP: null character in file name
  540. Similar to the above errors.
  541. .TP
  542. .B \fIapplication-name\fP: bad character in file name
  543. Similar to the above errors.
  544. Slashes, backslashes, and unprintable characters other than spaces are
  545. also prohibited in file names.
  546. .TP
  547. .B \fIapplication-name\fP: invalid output preamble format
  548. According the format used by \fBavram\fP for data files, a data file
  549. may contain an optional text portion, known as the preamble. This
  550. error occurs when a data file obtained from an application can not be
  551. written because the preamble is something other than a list of
  552. character strings.
  553. .TP
  554. .B \fIapplication-name\fP: invalid file specification
  555. This error occurs in situations where the data structure for a file
  556. obtained by evaluating the application is too broken to permit any
  557. more specific diagnosis.
  558. .TP
  559. .B \fBavram\fP: invalid raw file format in \fIapplication-name\fP
  560. The file containing the virtual machine code was not able to be
  561. loaded, because the code was not in a recognizable format.
  562. .RE
  563. .TP
  564. .B application programming errors
  565. A further class of application crashes results from miscellaneous bugs
  566. in the application. These require the application to be debugged and
  567. have no user level explanation or workaround, but are listed here for
  568. reference. These messages are not normally prefaced by the application
  569. name when reported unless the application elects to do so, except for
  570. the \fBinvalid profile identifier\fP message.
  571. .RS
  572. .TP
  573. .B invalid recursion
  574. .TP
  575. .B invalid comparison
  576. .TP
  577. .B invalid deconstruction
  578. .TP
  579. .B invalid transpose
  580. .TP
  581. .B invalid membership
  582. .TP
  583. .B invalid distribution
  584. .TP
  585. .B invalid concatenation
  586. .TP
  587. .B invalid assignment
  588. .TP
  589. .B unrecognized combinator (code \fInn\fP)
  590. .TP
  591. .B \fIapplication-name\fP: invalid profile identifier
  592. .TP
  593. .B unsupported hook
  594. .RE
  595. .TP
  596. .B configuration related errors
  597. The source code distribution of \fBavram\fP incorporates a flexible
  598. configuration script allowing it to be installed on a variety of
  599. platforms. Not all platforms allow support for all features. It is also
  600. anticipated that new features may be added to \fBavram\fP from time to
  601. time. Some problems may therefore occur due to features not being
  602. supported at your site for either of these reasons. The following error
  603. messages are relevant to these situations.
  604. .RS
  605. .TP
  606. .B unsupported hook
  607. If it's not simply due to an application programming error, this
  608. message may be the result of trying to use an application that
  609. requires a newer version of \fBavram\fP than the one installed, even
  610. though applications should avoid this problem by checking the version
  611. number at run time. If this is the reason, the solution would be to
  612. install the latest version.
  613. .TP
  614. .B \fIapplication-name\fP: I need avram linked with \fIfoo\fP, \fIbar\fP and \fIbaz\fP.
  615. A message of the this form indicates that a new installation may be
  616. needed. At this writing (11/11/1), \fBavram\fP may report this message
  617. with respect to \fBlibexpect5.32\fP, \fBtcl8.3\fP, and \fBlibutil\fP
  618. if any of the \fB-i\fP, \fB-t\fP, or \fB-s\fP options is used on a
  619. system where not all of these libraries were detected when \fBavram\fP
  620. was installed from a source distribution.
  621. Because \fBavram\fP is useful even without interactive applications,
  622. these libraries are not considered absolute prerequisites by the
  623. configuration script.
  624. .TP
  625. .B avram: can't emulate version \fIversion\fP
  626. The \fB--emulation=\fP\fIversion\fP option obviously won't work if the
  627. requested version is newer than the installed version, or if it is not
  628. a valid version number. When that happens, this message is printed
  629. instead and \fBavram\fP terminates.
  630. .TP
  631. .B avram: multiple version specifications
  632. The \fB--emulation=\fP\fIversion\fP option can be used at most once
  633. on a command line. This message is printed if it is used more than
  634. once.
  635. .TP
  636. .B avram: unrecognized option: \fIoption-name\fP
  637. may mean that a command line option has been misspelled, or may be another
  638. sign of an obsolete version of \fBavram\fP
  639. .TP
  640. .B \fIapplication-name\fP: warning: search paths not supported
  641. If the \fBargz.h\fP header file was not detected during configuration,
  642. \fBavram\fP will not be able to support search paths in the
  643. \fBAVMINPUTS\fP environment variable. This message is a warning that
  644. the environment variable is being ignored. If the warning is followed
  645. by an I/O error, the latter may be due to a file being in a path that
  646. was not searched for this reason. A workaround is to specify the full
  647. path names of all input files outside the current working directory.
  648. If you don't need search paths, you can get rid of this message by
  649. undefining \fBAVMINPUTS\fP.
  650. .RE
  651. .TP
  652. .B Other Diagnostics and Warnings
  653. .RS
  654. .TP
  655. .B avram: multiple -.EXT options; all but last ignored
  656. This message is written when more than one default extension is given as
  657. a command line parameter. At most one default extension is allowed. If
  658. more than one is given, only the last one is used. The error is
  659. non-fatal and \fBavram\fP will try to continue. If you need more
  660. than one default extension, consider using the hard coded default
  661. extensions of \fB.fun\fP and \fB.avm\fP, or hacking the shell script
  662. in which the \fBavram\fP command line appears.
  663. .TP
  664. .B \fIapplication-name\fP: empty operator
  665. This message probably means that the virtual code file is corrupt or
  666. invalid.
  667. .TP
  668. .B usage summary
  669. For any errors in usage not covered by other diagnostics, such as
  670. incompatible combinations of options, \fBavram\fP prints a message to
  671. standard error giving a brief summary of options, similar to the output
  672. from \fBavram --help\fP.
  673. .RE
  674. .SH EXAMPLE
  675. It is recommended that the application developer (or the compiler)
  676. package virtual machine code applications as shell scripts with the
  677. \fBavram\fP command line embedded in them. This style relieves the user
  678. of the need to remember the appropriate virtual machine options for
  679. invoking the application, which are always the same for a given
  680. application, or even to be aware of the virtual machine
  681. at all.
  682. .P
  683. Here is a script that performs a similar operation to the standard
  684. Unix \fBcat\fP utility. (That is, it copies the contents of a file whose
  685. name is given on the command line to standard output, or copies
  686. standard input to standard output if no file name is given.) This
  687. script can be marked executable (with \fBchmod\fP) and run by any user
  688. with the \fBavram\fP executable in his or her path (even if
  689. \fBavram\fP had to be installed in a non-standard directory such as
  690. ~/bin).
  691. .nf
  692. #!/bin/sh
  693. #\\
  694. exec avram --default-to-stdin "$0" "$@"
  695. sKYQNTP\\
  696. .fi
  697. The idea for this script is blatantly lifted from the \fBwish\fP
  698. manpage. The first line of the script invokes a shell to process
  699. what follows. The shell treats the second line as a comment and
  700. ignores it. Based on the third line, the shell invokes \fBavram\fP
  701. with the indicated option, the script itself as the next argument, and
  702. whatever command line parameters were initially supplied by the user
  703. as the remaining arguments. The rest of the script after
  704. that line is never processed by the shell.
  705. .P
  706. When \fBavram\fP attempts to load the shell script as a virtual
  707. machine code file, which happens as a result of it being executed by
  708. the shell, it treats the first line as a comment and ignores it. It
  709. also treats the second line as a comment, but takes heed of the
  710. trailing backslash, which is interpreted as a comment continuation
  711. character. It therefore also treats the third line as a comment and
  712. ignores it. Starting with the fourth line, it reads the virtual code,
  713. which is in a binary data format encoded with printable characters,
  714. and evaluates it.
  715. .SH FILES
  716. .TP
  717. .B ./profile.txt
  718. This file is written automatically by \fBavram\fP on behalf of
  719. applications that include profile annotations. It lists the number of
  720. invocations for each annotated part of the application, the total
  721. amount of time spent on it (in relative units), the average amount of
  722. time for each invocation, and the percentage of time relative to the
  723. remainder of the application.
  724. .SH ENVIRONMENT
  725. An environment variable \fBAVMINPUTS\fP can be made to store a list of
  726. directories (using the \fBset\fP or \fBexport\fP commands) that
  727. \fBavram\fP will search for input files. The directories should be
  728. separated by colons, similarly to the \fBPATH\fP environment variable.
  729. The search paths in \fBAVMINPUTS\fP apply only to the names of input
  730. files given on the command line when
  731. \fBavram\fP is invoked in parameter mode. They
  732. do not apply to the name of the virtual code file, which is always
  733. assumed to be either absolute or relative to the current working
  734. directory (this assumption being preferable in the case of a script like
  735. the example shown above).
  736. Starting in the first directory in the list of \fBAVMINPUTS\fP,
  737. \fBavram\fP searches for a file exactly as its name appears on the
  738. command line (subject to the expansion of special characters by the
  739. shell). If it is not found and the name does not contain a
  740. period, but a command line option of \fB-.EXT\fP has been used,
  741. \fBavram\fP will then search for a file with that name combined with
  742. the extension \fB.EXT\fP. If \fB-.EXT\fP has not been used or if no
  743. matching file is found with it, \fBavram\fP tries the extensions of \fB.avm\fP
  744. and \fB.fun\fP in that order, provided the given file name
  745. contained no periods. If no match is found for any of those cases,
  746. \fBavram\fP proceeds to search the next directory in the list obtained
  747. from \fBAVMINPUTS\fP, and so on. It stops searching when the first
  748. match is found. For subsequent input files, the search begins again at
  749. the first directory.
  750. If \fBAVMINPUTS\fP is not defined, input file names are assumed to be
  751. absolute or relative to the current working directory. If it is defined,
  752. the current working directory is not searched for input files unless it
  753. is listed.
  754. If \fBAVMINPUTS\fP is defined, the current working directory is not
  755. searched for input files unless it is listed. If it is empty or not
  756. defined, a default list of search paths is used, currently
  757. .nf
  758. .:/usr/local/lib/avm:/usr/lib/avm:/lib/avm:/opt/avm:/opt/lib/avm
  759. .fi
  760. These paths are defined in \fBavram.c\fP and can be changed
  761. by recompiling it.
  762. .SH BUGS
  763. There are no known bugs outstanding, except for any that may be
  764. inherent in the external library functions. However, \fBavram\fP has
  765. been used most extensively on GNU/Linux systems, and the prospect
  766. of portability issues with new or lesser used features on other
  767. systems can't be excluded.
  768. Though not observed in practice, it's theoretically possible to blow
  769. the stack by passing enough functions as arguments to library
  770. functions that pass more functions to library functions (e.g., by
  771. using nested calls to the gsl integration functions meant for a single
  772. variable to evaluate a very high dimensional multiple integral). In
  773. all other cases only dynamic heap storage or a constant amount of
  774. stack space is used. In particular, this issue is *not* relevant to
  775. virtual code applications that don't use external libraries, or that
  776. don't pass functions to them as arguments.
  777. \fBavram\fP is designed to recover gracefully from memory overflows by
  778. always checking for \fBNULL\fP results from \fBmalloc()\fP or
  779. otherwise trapping functions that allocate memory. In the event of an
  780. overflow, it conveys an appropriate error message to the virtual code
  781. application to be handled by the usual exception handling mechanisms.
  782. However, there is currently no way for a virtual code application to
  783. detect in advance whether sufficient memory is available, nor for it
  784. to resume normal operation once an exception occurs. Furthermore, it
  785. has been observed on some systems including Irix and 2.4 series Linux
  786. kernels that the \fBavram\fP process is killed automatically for
  787. attempting to allocate too much memory rather than given the chance to
  788. recover.
  789. Please send bug reports to the address below.
  790. .SH SEE ALSO
  791. .BR cat (1),
  792. .BR libexpect (3),
  793. .BR wish (1),
  794. .BR bash_builtins (1),
  795. .BR ulimit (1),
  796. .BR strerror (3),
  797. .BR stdin (3),
  798. .BR stdout (3),
  799. .BR stderror (3),
  800. .BR info (1),
  801. .BR pinfo (1),
  802. .BR chmod (1),
  803. .BR set (1),
  804. .BR export (1),
  805. .BR sh (3).
  806. The full documentation for \fBavram\fP is maintained as a Texinfo
  807. manual. If the \fBinfo\fP and \fBavram\fP programs are properly
  808. installed at your site, the command \fBinfo avram\fP or \fBpinfo
  809. avram\fP should give you access to the complete manual. Debian
  810. GNU/Linux users could have a look under \fB/usr/share/doc/*avram*\fP
  811. for possible html or postscript documentation and examples.
  812. .SH AUTHOR
  813. Dennis Furey <[email protected]>.