home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / bbs / ff810.lha / FF810 / Amiga_E / Docs / Utility.doc < prev    next >
Text File  |  1993-01-24  |  20KB  |  658 lines

  1.         +-----------------------------------------------+
  2.         |                        |
  3.         |                 Amiga E v2.1                  |
  4.         |          Compiler for The E Language          |
  5.         |           By Wouter van Oortmerssen           |
  6.         |                        |
  7.          |                 Utility.doc                   |
  8.         |                        |
  9.         +-----------------------------------------------+
  10.  
  11.  
  12. This document describes the functioning of the programs in the
  13. sources/ directory, and most important: the utilities found there.
  14. All of these programs are suplied in the form of an E-sourcecode,
  15. some also as executable (while being part of the compiler support
  16. utilities, rather than an example source)
  17.  
  18. contents:     Utilities/ShowModule.e
  19.             ShowHunk.e
  20.             ShowChunk.e
  21.             Iconvert.e
  22.             Pragma2Module.e
  23.             DirQuick.e
  24.             D.e
  25.             Watch.e
  26.             Mem.e
  27.             QuickLaunch.e
  28.             SuperVisor.e
  29.             Nkript.e
  30.  
  31.                    /Bin/ecompile.rexx
  32.  
  33.                Examples/GadToolDemo.e
  34.             AppMenuItem.e
  35.             Req.e
  36.             Reqtools.e
  37.             Asl.e
  38.             Ereq.e
  39.             GetArgs.e
  40.             WbArg.e
  41.             ReadArgs.e
  42.             Helloworld.e
  43.             Shell.e
  44.             Colourscreen.e
  45.             24bitColourDemo.e
  46.  
  47.                   Other/Pyth.e
  48.             Avail.e
  49.             Draw.e
  50.             Vd.e
  51.             Talk.e
  52.  
  53.                Projects/Forth.e
  54.             Pi.e
  55.             RewriteGfx.e
  56.             Yax.e
  57.  
  58.  
  59. +---------------------------------------+
  60. |    SHOWMODULE.E            |
  61. +---------------------------------------+
  62. sources/utilities/showmodule.e, bin/showmodule
  63.  
  64. As you might have noticed, E's equivalent for "includes", modules,
  65. are binary files, much like those usually suplied with Modula2
  66. compilers, for example. To display the contents of such a file
  67. in readable ascii form, you may use showmodule:
  68.  
  69. showmodule <modulespec>
  70.  
  71. examples:
  72.  
  73. 1> showmodule emodules:intuition/intuition.m
  74. 1> showmodule >gadtools.txt emodules:gadtools.m
  75.  
  76. note that showmodule by default outputs to the console,
  77. and may be interrupted at any point by <ctrlc>.
  78.  
  79.  
  80. +---------------------------------------+
  81. |    SHOWHUNK.E            |
  82. +---------------------------------------+
  83. sources/utilities/showhunk.e, bin/showhunk
  84.  
  85. Displays all types of executable files, and also object ".o"
  86. files as generated by (other) compilers/assemblers.
  87. will show you the (very simple) structure of executables generated
  88. by EC, but also support complex overlay-files. also dumps
  89. labels (like XREF's and XDEF's)
  90.  
  91. showhunk <exefile>
  92.  
  93. like:   1> showhunk helloworld
  94.         1> showhunk dpaint
  95.  
  96.  
  97. +---------------------------------------+
  98. |    SHOWCHUNK.E            |
  99. +---------------------------------------+
  100. sources/utilities/showchunk.e
  101.  
  102. shows the inner structure of all types of IFF files. does not
  103. display or play anything, but reports on a great number of chunks.
  104. this way you may find out how some animation is build up, or who
  105. is the author of a certain SMUS masterpiece.
  106. supports ILBM, ANIM, SMUS, 8SVX, FTXT, PREF, MDBI for now.
  107.  
  108. showchunk <ifffile>
  109.  
  110. 1> showchunk mypic.iff
  111.  
  112.  
  113. +---------------------------------------+
  114. |    ICONVERT.E            |
  115. |    PRAGMA2MODULE.E            |
  116. +---------------------------------------+
  117. sources/utilities/iconvert.e, bin/iconvert
  118. sources/utilities/pragma2module.e, bin/pragma2module
  119.  
  120. These two utilities are for advanced E-programmers only. if
  121. you don't feel like one (yet), skip this part.
  122.  
  123. Iconvert will convert structure and constant definitions in
  124. assembly ".i" files to E modules, and pragma2module will do the
  125. same for SAS/C pragma library definition files. ofcourse, all
  126. commodores includes have already been converted this way, but
  127. say you find a nice PD library that you may want to use with E,
  128. you will need these utilities.
  129.  
  130. most libraries come with various includes defining, most obvious,
  131. the library calls of the library, as well as the constants
  132. and structures (OBJECTs in E) that it uses. say that it is
  133. called "tools.library", then it will probably feature:
  134.  
  135. pragmas/tools_pragmas.h
  136. includes/tools.h
  137. includes/tools.i
  138.  
  139. then do:
  140.  
  141. 1> pragma2module tools_pragmas.h
  142.  
  143. rename the resulting "tools_pragmas.m" to "tools.m" and put it
  144. in emodules:, check with ShowModule if all went well.
  145.  
  146. Now, in your program you may use tools.library:
  147.  
  148. MODULE 'tools'
  149.  
  150. PROC main()
  151.   IF (toolsbase:=Openlibrary('tools.library',37))=NIL THEN error()
  152.  
  153.   toolsfunc()
  154.  
  155. ...etc.
  156.  
  157. convert tools.i with Iconvert to another tools.m, which you place in
  158. emodules:libraries, for example. Iconvert needs an assembler like
  159. the PD A68k to do the hard work of understanding the actual assembly.
  160.  
  161. 1> iconvert tools.i
  162.  
  163. see with showmodule what became of the ".i" file. use in your
  164. program with:
  165.  
  166. MODULE 'libraries/tools'
  167.  
  168. DEF x:toolsobj, y=TOOLS_CONST
  169.  
  170. converting with Iconvert may require some assembly expertise, as
  171. Iconvert relies on the correct format of the ".i" file, just like
  172. commodores assembly includes. About 10% of the ".i" files need
  173. to be patched by hand to be "convertable". definitions that
  174. Iconvert judges correctly are amongst others
  175.  
  176. <label> EQU <any_expression>
  177.  
  178. STRUCTURE <sname>,0      ; if <>0, then   <struct>_SIZEOF
  179. ULONG <sname>_<label>
  180. BPTR <sname>_<label>
  181.    ; etc.
  182. LABEL <sname>_SIZEOF     ; or "_SIZE"
  183.  
  184. to get an idea what kind of assembly-expression Iconvert can
  185. handle, take a peek in the source code.
  186.  
  187.  
  188. +---------------------------------------+
  189. |    DIRQUICK.E            |
  190. +---------------------------------------+
  191. sources/utilities/dirquick.e
  192.  
  193. Very small directory lister, the little brother of D.e.
  194. does nothing fancy, but is a nice short example
  195. works with os v33
  196.  
  197.  
  198. +---------------------------------------+
  199. |    D.E                |
  200. +---------------------------------------+
  201. sources/utilities/d.e, bin/d, needs v37
  202.  
  203. Universal directory lister suplied with Amiga E. called with no
  204. arguments, by just typing "d", it lists the current directory.
  205. template:
  206.  
  207. DIR,REC/S,COL/K/N,SIZE/S,NOSORT/S,NOFILES/S,NODIRS/S,FULL/S,NOANSI/S,
  208. TARGET/K,DO/K/F
  209.  
  210. DIR        specifies an optional path to the dir you wish to list.
  211.         may contain standard wildcard patterns like #?~[]%() etc.
  212. REC        specifies that subdirectories should be listed recursively.
  213. COL <num>    where n=1..3, by default, D list dirs in three columns to
  214.         keep all nice and compact. specify 1 or 2 if you like.
  215. SIZE        reports the size of each dir as it is being listed. note that
  216.         combined with REC gives sizes of whole dir (sub-)trees.
  217. NOSORT        by default, dirs are sorted before display. disable this with
  218.         the NOSORT switch.
  219. NOFILES        displays just dirs
  220. NODIRS        displays just files
  221. FULL        lists full path instead of just filename
  222. NOANSI        doesn't use ansi display codes while printing
  223. TARGET <dir>    specifies a target directory for use with DO. should
  224.         end in either "/" or ":"
  225. DO <comline>    specifies a commandline for automatic script generation.
  226.         note that this uses up the rest of D's commandline.
  227.  
  228. something should be said on the script feature: it enables you
  229. to perform repetitive tasks on whole dirs, or dir-trees. existing
  230. utilities that enabled you to do such tasks where mostly not
  231. flexible enough; d enables you to use the REC keyword in combination
  232. with scripts, allows for variable extensions: use <file>.o if
  233. the original name was <file>.s, and the spec. of a target:
  234. resulting files from the operation are placed in another dir, which
  235. can be a complete mirror image of another dir-tree. makedir
  236. statements are inserted if target: is empty.
  237.  
  238. following format codes may be used in <commandline>:
  239.  
  240. %s is file (filename+path)
  241. %f is file WITHOUT extension
  242. %r is file without extension, but with leading <dir> replaced by
  243.    <target> (usefull if <commandline> allows for an outputfile)
  244. %> or %< %>> etc. prevents the shell from thinking ">" is a redirection
  245.    for D, instead of <commandline>
  246.  
  247. a complex example:
  248. you wish to have a complete ascii reference of the emodules:
  249. directory, recursively, and with the resulting .txt files
  250. as a mirror-image directory structure somewhere else.
  251.  
  252. 1> D >ram:script emodules: REC TARGET=t:mods/ DO showmodule %>%r.txt %s
  253. 1> execute ram:script
  254.  
  255. will do that for you.
  256. for any file like "emodules:exec/io.m" D will make a line like:
  257. "showmodule  >t:mods/exec/io.txt emodules:exec/io.m"
  258.  
  259. other examples:    D >mydirlist dh0: COL=2 SIZE REC NOANSI
  260.         D docs: DO type >prt: %s
  261.         D asm: TARGET=obj: DO genam %s -o%r.o
  262.  
  263.  
  264. +---------------------------------------+
  265. |    WATCH.E                |
  266. +---------------------------------------+
  267. sources/utilities/watch.e, needs v37
  268.  
  269. simply "watches" a file, using the new notification system
  270. of kick2.0. note: does not _prevent_ files from being modified,
  271. just tells you. usefull, for example, if you're installing a new
  272. software package, and you want to know wether the installer
  273. does something funny to your startup-sequence or user-startup.
  274.  
  275. 1> run watch s:startup-sequence
  276.  
  277. note that the only way to stop watching is asctually modifying
  278. the file. (or rebooting :-)
  279.  
  280.  
  281. +---------------------------------------+
  282. |    MEM.E                |
  283. +---------------------------------------+
  284. sources/utilities/mem.e
  285.  
  286. simply dumps memory in a shell, usefull for hardcore-kamikaze
  287. debugging and the like.
  288.  
  289. try:
  290. 1> mem $f80000        ; only if you have a non-moved kick2.0 or better
  291.  
  292.  
  293. +---------------------------------------+
  294. |    QUICKLAUNCH.E            |
  295. +---------------------------------------+
  296. sources/utilities/quicklaunch.e
  297.  
  298. Pops up a window with gadgets named after utils mentioned in a
  299. text file, to be able to launch them. Allows for the control of
  300. outputwindows when run from workbench.
  301. Needs textfile named "s:quicklaunch.config" to know what to run.
  302. format: odd lines = names, even = path of utils. be sure
  303. to add exactly one last <return>
  304.  
  305.  
  306. +---------------------------------------+
  307. |    SUPERVISOR.E            |
  308. +---------------------------------------+
  309. sources/utilities/supervisor.e
  310.  
  311. A very small system-monitor, displays tasks and the like.
  312. Press different gadgets to see different lists.
  313. Lists are only updated when gadgets are pressed or the
  314. supervisor window is resized.
  315.  
  316.  
  317. +---------------------------------------+
  318. |    NKRIPT.E            |
  319. +---------------------------------------+
  320. sources/utilities/nkript.e
  321.  
  322. Nkript is very simple file (de)coder
  323. USAGE: nkript <file>
  324.  
  325. nkript asks for a 4 letter key, and a 3 letter pincode.
  326. as nkript uses EOR, you may use this program to code and
  327. decode. the key and pincode are not stored anywhere, so it
  328. _relatively_ safe. this has the effect that if you type the
  329. wrong key, no error is given, but the file is simply
  330. decoded wrong.
  331.  
  332.  
  333. +---------------------------------------+
  334. |    ECOMPILE.REXX            |
  335. +---------------------------------------+
  336. /bin/ecompile.rexx
  337.  
  338. As this was the only Arexx script in the distribution, i threw
  339. it in the Bin directory. I hope to be able to include more rexx
  340. scripts in some next release, for other editors
  341.  
  342. This is a rexx-script for CygnusEd (tm), and enables you to
  343. compile E programs from the editor. Just assign this script
  344. a function key in the editor with "Install Dos/Arexx command ..."
  345. (check your CED-manual if you're not sure how to do this).
  346. Then you may define an additional macro that includes an
  347. Amiga-w keypress (save) and the key you assigned the script to.
  348. Now write your programs, and press Fx if you wish to compile.
  349. Your source will be saved, the compiler will be invoked with a
  350. separate console window, and the program is run on the same
  351. console. When your program is done, you may press <return>
  352. to return to the editor (CED-screen to back and front is
  353. automatically done by the script). If an error occurred during
  354. compilation, the script will let CED jump to the line of
  355. error after you pressed <return>
  356.  
  357. Note: in the script are some path names as to were the compiler
  358. can be found. You probably need to change this. Also, the script
  359. copies EC to ram: for systems with a slower SYS: device, you may
  360. want to disable this if you have a fast HD.
  361.  
  362.  
  363. +---------------------------------------+
  364. |    GADTOOLSDEMO.E            |
  365. |    APPMENUITEM.E            |
  366. +---------------------------------------+
  367. sources/examples/gadtoolsdemo.e
  368. sources/examples/appmenuitem.e
  369.  
  370. Two examples that show nicely how to do 2.0-system-programming
  371. in Amiga E. Especially the extensive use of (typed-)lists
  372. in gadtoolsdemo.e is impressive.
  373.  
  374.  
  375. +---------------------------------------+
  376. |    REQ.E                |
  377. |    REQTOOLS.E            |
  378. |    ASL.E                |
  379. |    EREQ.E                |
  380. +---------------------------------------+
  381. sources/examples/req.e
  382. sources/examples/reqtools.e
  383. sources/examples/asl.e
  384. sources/examples/ereq.e
  385.  
  386. Four examples that show usage of all sorts of requesters from
  387. external libraries and system programming. the first two are
  388. ofcourse about the two famous PD requester libraries, while the
  389. last two demo requester facilities that come with kick2.0
  390.  
  391.  
  392. +---------------------------------------+
  393. |    GETARGS.E            |
  394. |    READARGS.E            |
  395. |    WBARG.E                |
  396. +---------------------------------------+
  397. sources/examples/getargs.e
  398. sources/examples/readargs.e
  399. sources/examples/wbarg.e
  400.  
  401. Three examples that show how to get your args to your programs.
  402. the first two are about commandline args from a shell, the last
  403. about getting args in a workbench environment. of the firts two,
  404. the first is the general example, while the second is 2.0 specific,
  405. using ReadArgs().
  406.  
  407.  
  408. +---------------------------------------+
  409. |    HELLOWORLD.E            |
  410. |    COLOURSCREEN.E            |
  411. |    SHELL.E                |
  412. +---------------------------------------+
  413. sources/examples/helloworld.e
  414. sources/examples/colourscreen.e
  415. sources/examples/shell.e
  416.  
  417. The three simplest, most straight forward examples to start with.
  418. give you a basic impression what E can look like.
  419.  
  420.  
  421. +---------------------------------------+
  422. |    24BITCOLOURDEMO.E        |
  423. +---------------------------------------+
  424. sources/examples/24bitcolourdemo.e
  425.  
  426. A small demo demonstrating the new 24bit palette of the newer AA
  427. Amigas. You'll need such an amiga and kick3 to run this demo, ofcourse.
  428. The demo will draw lines in 256 tints and less on the screen, and then
  429. lets you manipulate the colour-registers by pressing the leftMB on some
  430. (x,y) spot on the screen. These coordinates will serve as RGB values.
  431. To quit, press the rightMB.
  432.  
  433.  
  434. +---------------------------------------+
  435. |    PYTH.E                |
  436. +---------------------------------------+
  437. sources/other/pyth.e
  438.  
  439. An example variable-depth pythagoras tree generating program
  440. written by Raymond Hoving. Uses "reqtools.library".
  441.  
  442.  
  443. +---------------------------------------+
  444. |    AVAIL.E                |
  445. |    DRAW.E                |
  446. |    VD.E                |
  447. +---------------------------------------+
  448. sources/other/avail.e
  449. sources/other/draw.e
  450. sources/other/vd.e
  451.  
  452. Three little examples written by Erwin van Breemen, including
  453. an avail replacement, an image-processing package :-), and a
  454. vector checker.
  455.  
  456.  
  457. +---------------------------------------+
  458. |    TALK.E                |
  459. +---------------------------------------+
  460. sources/other/talk.e
  461.  
  462. A cli command written by Rob Verver that uses the 2.0 narrator.device
  463. to say texts. It allows for setting of _all_ new speech parameters
  464. through command line options.
  465.  
  466.  
  467. +---------------------------------------+
  468. |    FORTH.E                |
  469. +---------------------------------------+
  470. sources/projects/forth.e
  471.  
  472. A _very_ simple forth interpreter. nice example of how easy one
  473. can build interpreters for languages like this. It is far
  474. from a finished forth interpreter, so may be used to see how
  475. forth works, or as a stack-featured calculator.
  476.  
  477.  
  478. +---------------------------------------+
  479. |    PI.E                |
  480. +---------------------------------------+
  481. sources/projects/pi.e
  482.  
  483. A pi calculation program. nothing special except that it is one
  484. of the few program that demonstrate clearly the use of the inline
  485. assembler, and how to interface with E.
  486.  
  487.  
  488. +---------------------------------------+
  489. |    REWRITEGFX.E            |
  490. +---------------------------------------+
  491. sources/projects/rewritegfx.e
  492.  
  493. a graphics plotting system that uses rewrite-grammars. the idea is
  494. that the description of an image (much like some fractals i know)
  495. is denoted in a grammar, which is then used to plot the gfx.
  496. the system uses turtlegraphics for plotting, and some forth-heritage
  497. for additional power. the program is not meant to actually "used";
  498. change to different graphics with the CONST in the sources, to
  499. see what the grammars do.
  500.  
  501.  
  502. +---------------------------------------+
  503. |    YAX.E                |
  504. +---------------------------------------+
  505. sources/projects/yax.e
  506. sources/projects/yaxsrc/#?.yax
  507.  
  508. this is the largest "example" in the distribution, it's a
  509. complete programming language written in E, together with
  510. some example sources. It was written as an experiment to create
  511. a normal procedural programming language that is simpler in
  512. concept and more consistent. following is a minimum doc that
  513. i threw together for those of you who want to explore this
  514. language.
  515.  
  516.  
  517.         +---------------------------------------+
  518.         |                                       |
  519.         |       Amiga YAX Interpreter v0.x      |
  520.         |                                       |
  521.         |             (c) 1992 $#%!             |
  522.         |              M A N U A L              |
  523.         |                                       |
  524.         +---------------------------------------+
  525.  
  526.             1. Introduction
  527.             2. The Language
  528.             3. Built-in Functions
  529.  
  530.         +---------------------------------------+
  531.         |    1. Introduction            |
  532.         +---------------------------------------+
  533.  
  534. YAX stands for "Yet Another Instruction Code Set", as the author couldn't
  535. think of better name. YAX is a procedural language with LISP-syntax and
  536. evaluation, as well as somewhat lambda function application.
  537.  
  538. In this manual it is asumed the reader possesses knowledge of other
  539. languages, as all 'obvious' explanations are left out. Readers for whom
  540. YAX would be their first programming language are advised to read
  541. a standard text on the subject  8-).
  542.  
  543.         +---------------------------------------+
  544.         |    2. The Language            |
  545.         +---------------------------------------+
  546.  
  547. Structure.
  548. The basic building block of a YAX program is called a term.
  549. Examples of terms are:
  550.  
  551. integer constants:    1 2 100 -1
  552. string constants:    'a' 'hi folks!'
  553. variables:        a count
  554. function calls:        (+ 1 2) (* 3 (- 4 5))
  555.  
  556. a function call is a list '()' with as first item the name of the
  557. function to be applied, followed by its arguments. With few execeptions,
  558. arguments to functions are again terms, so expressions may be built
  559. to infinite complexity. The main task of the interpreter is to
  560. evaluate these terms recursively.
  561.  
  562. Format.
  563. between any two lexical elements, any number of spaces, tabs and linefeeds
  564. may be placed. Comments start with '/*' and end with '/*', may extend
  565. over several lines, and may be nested. following to statements are equal:
  566.  
  567. (if(eq a 1)(for b 1 10(write'blabla')))       /* ugly */
  568.  
  569. (if (eq a 1)
  570.   (for b 1 10 (write 'blabla'))               /* better */
  571. )
  572.  
  573.  
  574.         +---------------------------------------+
  575.         |    3. Built-in Functions        |
  576.         +---------------------------------------+
  577.  
  578. If not explicitly stated, functions return 0. type of arguments:
  579.  
  580. <term>        any term
  581. <iterm>        term that evaluates to integer
  582. <sterm>        term that evaluates to string
  583. <var>        term that is a variable
  584. <svar>        term that is a string variable
  585. <func>        term that evaluates to a function
  586. ...        any number of terms of the same type may follow
  587.  
  588.                            --> INTEGER MATH <--
  589.  
  590. (add <iterm> ...)     or    (+ <iterm> ...)
  591. (sub <iterm> ...)     or    (- <iterm> ...)
  592. (mul <iterm> ...)     or    (* <iterm> ...)
  593. (div <iterm> ...)     or    (/ <iterm> ...)
  594.  
  595. (and <iterm> ...)
  596. (or <iterm> ...)
  597. (not <iterm>)
  598.  
  599. (eq <iterm> ...)
  600. (uneq <iterm> <iterm>)
  601. (smaller <iterm> <iterm>)
  602. (greater <iterm> <iterm>)
  603.  
  604. These functions perform the functions you'd expect them to do.
  605. All boolean logic functions return true (-1) or false (0). and/or/not
  606. work as logical as well as bitwise operators.
  607. except for the last three, all functions handle any number of arguments,
  608. i.e.  (eq 10 (+ 1 2 3 4) (* 2 5))  is a valid term.
  609.  
  610.                          --> PROGRAM STRUCTURE <--
  611.  
  612. (for <var> <iterm> <iterm> <term> ...)
  613. (if <boolexp> <ifterm> <elseterm>)
  614. (do <term> ...)
  615. (select <iterm> <term> ...)
  616. (while <term> <term> ...)
  617. (until <term> <term> ...)
  618. (set <var> <term>)
  619.  
  620. (defun <var> (<var> ...) <term> ...)
  621. (lambda (var ...) <term> ...)
  622. (apply <func> <term> ...)
  623.  
  624. (array <var> <iterm>)
  625. (string <var>)
  626.  
  627.  
  628.                            --> INPUT OUTPUT <--
  629.  
  630. (write <term> ...)
  631. (locate <iterm> <iterm>)
  632. (cls)
  633. (window <iterm> <iterm> <iterm> <iterm> <sterm>)
  634.  
  635. (tell <sterm>)            open a file for writing
  636. (told)                close file
  637. (see <sterm>)            open a file for reading
  638. (seen)                close file
  639. (filelen <sterm>)        get filelength
  640.  
  641. (readint)            read an integer
  642. (read <svar>)            read a string
  643. (get)                read one character
  644. (put <iterm>)            write one character
  645.  
  646. (dump)                show all variables
  647.  
  648.  
  649.                              --> GRAPHICS <--
  650.  
  651. (line <iterm> <iterm> <iterm> <iterm> <iterm>)
  652. (plot <iterm> <iterm> <iterm>)
  653. (box <iterm> <iterm> <iterm> <iterm> <iterm>)
  654. (text <iterm> <iterm> <iterm> <iterm> <sterm>)
  655. (mousex)
  656. (mousey)
  657. (mouse)
  658.