home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 182.lha / APE / ape.doc < prev    next >
Encoding:
Text File  |  1988-04-28  |  19.9 KB  |  527 lines

  1.     An Amiga Programming Environment    ---    APE v1.00
  2.     --------------------------------           ---------
  3.                                (c)1988 SofThing
  4.  
  5.  
  6.     APE is a workbench based tool for C projects. It arose out of my dislike
  7. for the CLI and other command line interfaces. I hope you find it useful.
  8.  
  9.     I am releasing this as shareware. A contribution of $20 will make you a
  10. registered user, eligible for free (i.e. cost of postage and disk) upgrades.
  11. Whether or not you are a registered user, comments and suggestions are
  12. most welcome.
  13.  
  14.     To use APE, you need your own program editor, compiler and linker. APE
  15. makes use of these and a simple "make" like description of your project,
  16. which it maintains. It opens a workbench window with menus for operations
  17. and scrolling displays of source and include files used in your project.
  18.  
  19.     FILES PROVIDED
  20.     --------------
  21.     APE            The executable. Normally run from the workbench by
  22.                double-clicking on its icon or on a project icon.
  23.                Can be invoked from the CLI, taking no command line
  24.                arguments, or a single project name ( a project to
  25.                be opened ). Detaches itself when run from the CLI,
  26.                i.e. no need use RUN or RUNBACK.
  27.  
  28.     In s/
  29.      lattice.apesrc    A sample .apesrc file suitable for a system using
  30.                Matt Dillon's DME editor, the Lattice C compiler
  31.                and the public domain linker BLINK.
  32.                This must be renamed .apesrc to be used.
  33.                .apesrc is created/modified using the APE's CUSTOM
  34.                menu. Specifies the name of your editor (e.g. sys:dme)
  35.                , compiler (Phase 1 and 2), and linker (e.g. blink).
  36.                Also specifies whether your system has a battery-
  37.                backed clock, and some default settings used
  38.                when creating new APE projects.
  39.     **** APE looks for .apesrc in :s, then in sys:s and finally in s:.
  40.  
  41.     In templates/
  42.     project.info   Icon for APE projects. Feel free to substitute your
  43.                own. The default tool should reflect where you have
  44.                located APE.
  45.     program.info   Icon for executables produced by APE. (Same as the APE
  46.                icon - APE was built using APE, naturally). If using
  47.                Manx, you may want to add a window specification in
  48.                the tool types field.
  49.     **** APE looks for these files in :templates, then in sys:templates and
  50.     **** finally in templates:.
  51.  
  52.  
  53.     SETTING UP
  54.     ----------
  55.  
  56.     Put APE wherever you like but remember to change the default tool
  57.     for templates/project.info to match. APE needs the commands CD,
  58.     STACK, ASSIGN, IF, SKIP, LAB, FAILAT, ECHO, ENDCLI, EXECUTE and RUN
  59.     ( also SET and PATH if you use them ). It also uses the ram: device. If
  60.     you are going to print files from APE, then you also need a printer
  61.     driver and the command COPY.
  62.     Put .apesrc in a directory called s on your boot disk or your
  63.     project disk, or in a place which you assign the logical name s: ( this
  64.     is assigned to the path sys:s when you boot ).
  65.     You can run APE to set up your .apesrc file according to the way
  66.     you set up your tools. New settings will be saved when you exit APE.
  67.     Put the template files in a directory called templates on your
  68.     boot disk or your project disk, or in a place which you assign the
  69.     logical name templates:.
  70.  
  71.  
  72.     OPERATION
  73.     ---------
  74.  
  75.     Most of the menu items are reasonably self-explanatory.
  76.  
  77.     To create a new project, double-click on the APE icon. When the
  78.     APE window opens, set up your custom settings as described above if you
  79.     have not done so before. Now select NEW from the PROJECT menu.
  80.  
  81.     Type the name (full pathname unless the project is to go at the top
  82.     of the current filing system) into the requester. A new project will be
  83.     created and opened, with two (empty) scrolling displays appearing in the
  84.     window. The name of the project will appear in the window title.
  85.     The display labelled "Source Files" shows .c files to be compiled for
  86.     this project. The one labelled "Include Files" shows .h files #included
  87.     in the .c files. These would usually be your own .h files, not any
  88.     system ones you may #include.
  89.  
  90.     Select the ASSIGNS item from the SPECIAL menu. This allows you to
  91.     specify pathnames for logical names such as LIB:, INCLUDE: and QUAD: as
  92.     used by the Lattice compiler. Also use the OTHER .O'S and the
  93.     LIBRARIES items for this menu as described in the summary below.
  94.     These should all have been given default values but you can vary them
  95.     for each project.
  96.  
  97.     To add a source file to the project, select NEW from the FILES menu.
  98.     A requester will prompt you for the file name. This should not be a
  99.     pathname - APE v1.00 can't deal with that. A new item will appear in the
  100.     top scroller.
  101.  
  102.     Now double-click on the new item, or click once on it to select it
  103.     (it will then be highlighted - click again to deselect) and choose
  104.     EDIT from the FILES menu. This will invoke your editor on this file.
  105.  
  106.     When you have finished editing, select that item again and choose
  107.     INCLUDES from the FILES menu. A requester will appear to allow you
  108.     to specify up to seven .h files to be included in this .c file. This
  109.     is used by APE's simple make facility. It doesn't have to be the truth.
  110.     Include files can also be specified for each .h file, but be careful,
  111.     APE doesn't check for possible nasties such as circular inclusions.
  112.  
  113.     If you added .h files in this way, new items will appear in the
  114.     second scroller. These can be double-clicked on in the same way as
  115.     the .c items.
  116.  
  117.     Multiple files can be selected in each scroller by holding down the
  118.     shift key and clicking.
  119.  
  120.     To exit APE, click on the close gadget, or select QUIT from the
  121.     PROJECT menu.
  122.  
  123.  
  124.     SUMMARY OF MENU OPERATIONS
  125.     --------------------------
  126.  
  127.     PROJECT
  128.  
  129.         OPEN    Open an existing project. If you already have
  130.             another project open it will be closed first.
  131.  
  132.         NEW     Create and open a new project. Any project
  133.             already open will be closed.
  134.  
  135.         MAKE    Compile all .c files that have changed ( or whose
  136.             .h files have changed ) since last compiled.
  137.             Link everything to create a new executable.
  138.  
  139.         LINK    Just link without recompiling.
  140.  
  141.         BUILD    Create a copy of the executable, with icon, wherever
  142.             you want to put it.
  143.  
  144.         QUIT    Quit APE after confirmation.
  145.  
  146.         ABOUT    Displays a message pleading for money.
  147.  
  148.     FILES
  149.  
  150.         EDIT    Invoke your editor on the selected source and
  151.             include files.
  152.  
  153.         COMPILE    Invoke your compiler on the selected source files.
  154.  
  155.         PRINT    Print selected files in the background.
  156.  
  157.         FIND    Search selected files ( or all files ) for a given
  158.             pattern string. Produces a listing which may be
  159.             directed to the console or to the printer.
  160.             The pattern string is a regular expression as
  161.             described in the appendix.
  162.  
  163.         INCLUDES    Specify .h files #included in the selected files.
  164.             Will ignore selections of include files if any
  165.             source file selections were made, and will ignore
  166.             all but the first selected include file in any case.
  167.  
  168.         TOUCH    "Change" the selected files so that APE will
  169.             think they need to be compiled.
  170.  
  171.         NEW     Add a new source file to the project. The filename
  172.             should have a .c extension.
  173.  
  174.         EXPUNGE    Remove the selected source files from the project.
  175.             Confirmation is requested and the .c and
  176.             corresponding .o files are actually only moved to
  177.             the trashcan drawer. If any .h files are no longer
  178.             needed in the project, these are also moved to the
  179.             trashcan after confirmation.
  180.  
  181.     RUN
  182.         GO        Open a new CLI and invoke your program using
  183.             supplied command line arguments. After termination,
  184.             returns to APE. Obviously your program must be
  185.             able to run from the CLI.
  186.  
  187.         ARGUMENTS    Specify command line arguments to your program.
  188.  
  189.     SPECIAL
  190.  
  191.         PATH    Specify a search path for commands.
  192.  
  193.         ASSIGNS    Specify pathnames for logical names such as
  194.             LIB:, INCLUDE: and QUAD:.
  195.             The requester that appears has two columns of
  196.             string gadgets. The first column is for logical
  197.             names; the second is for the corresponding paths.
  198.             Note that if you make an assignment to QUAD:
  199.             APE will assume that you are using the Lattice
  200.             compiler and will try to use the -o and -q options
  201.             to use the QUAD: directory for temporary .q files.
  202.  
  203.         SETS    Specify values for environment variables to be
  204.             set using the SET command.
  205.             The requester that appears has two columns of string
  206.             gadgets. The first column is for variable names;
  207.             the second is for the correspong values.
  208.  
  209.         LIBRARIES    Specify library files to be linked in (usually
  210.             LIB:lc.lib and LIB:amiga.lib for Lattice). For the
  211.             Lattice compiler this is where library files should
  212.             be specified. For the Manx compiler, you can put
  213.             library files here, or use -Lxxx linker options.
  214.  
  215.         OTHER .O'S  Specify any other .o files to be linked in (usually
  216.             LIB:c.o for Lattice).
  217.  
  218.         OPTIONS    Specify any editor, compiler or linker options to
  219.             be used for this project. Don't specify -o options
  220.             for the compiler or linker or things will get into
  221.             a mess. APE uses these for itself. Other strange
  222.             options may also cause problems.
  223.  
  224.         STACK    Specify the stack size for commands in bytes
  225.             (usually 4000).
  226.  
  227.     CUSTOM
  228.  
  229.         TOOLS    Specify the editor, compiler and linker to be used
  230.             in your system. Has separate entries for each phase
  231.             of the compiler. Just leave the phase 2 entry blank
  232.             if you are using a one pass compiler.
  233.  
  234.         LINKER SYNTAX
  235.             Specify whether your linker conforms to the syntax
  236.             of BLINK and ALINK, or to Manx's ln. See the
  237.             discussion of LIMITATIONS below.
  238.  
  239.         CLOCK    Specify whether you have a battery-backed clock.
  240.             APE plays funny tricks to try to keep the project
  241.             in step for people without one. You can say that
  242.             you have got one even if you haven't, but APE may
  243.             become confused about what is up to date unless you
  244.             diligently set the clock each time before using APE.
  245.  
  246.     STANDARD SETTINGS
  247.             Enter default values for the items on the SPECIAL
  248.             menu to be used when creating new projects.
  249.  
  250.  
  251.     HOW (SOME OF) IT WORKS
  252.     ----------------------
  253.  
  254.     Each project is really a directory containing all the .c, .o and
  255.     .h files, the executable, and a description of the project in a text
  256.     file called .project. You can examine this and it will be fairly clear
  257.     what its structure is. The strings of digits and colons represent
  258.     timestamps of files and are used by APE if you don't have a battery-
  259.     backed clock. If you should lose this file by some accident you should
  260.     be able to rescue the project by creating a new one by hand ( or using
  261.     the CRAPE utility ).
  262.  
  263.     For systems without a battery-backed clock, APE records the
  264.     timestamp of each file in the project when closing the project and
  265.     checks them for possible tampering the next time the project is
  266.     opened. Any file whose timestamp doesn't match the one recorded is
  267.     assumed to be out of date. Using these, APE tries to figure out a
  268.     logical creation sequence for the files and then 'touches' each file
  269.     in this sequence. From then on in that APE session, the files' current
  270.     timestamps can be used to tell what is or is not up to date.
  271.  
  272.     To run your editor, compiler and linker, APE constructs script files
  273.     in ram: and calls Execute to create a new CLI task to execute them
  274.     synchronously with APE. This is a pretty awful method but it works OK.
  275.     It would be so much nicer if some commercial compiler writer would
  276.     create for us a truly integrated programming environment and I guess
  277.     this will come eventually. In the meantime, at least we now have APE!
  278.  
  279.  
  280.     SOME LIMITATIONS
  281.     ----------------
  282.  
  283.     APE is only suitable for simple projects at this stage of
  284.     development. It will probably be given more functionality in later
  285.     releases to make it more generally useful.
  286.  
  287.     The tools that you use must conform to the syntax that APE expects:
  288.  
  289.     <editor> <options> <filename>
  290.  
  291.     <compiler phase 1> <options> <filename without extension>
  292.  
  293.     <compiler phase 2> <options> <filename without extension>
  294.  
  295.     APE supports linkers having the same syntax as BLINK and ALINK, and
  296.     also linkers like the Manx ln linker. You specify which kind of linker
  297.     you have with the LINKER SYNTAX item in the CUSTOM menu. In each case, a
  298.     "with" file is created and the linker is invoked with the command line:
  299.  
  300.     <linker> WITH <withfilename>    (BLINK type)
  301. or  <linker> -f <withfilename>        (Manx ln type).
  302.  
  303.     The with file constructed contains the command sequence:
  304.  
  305.     TO <projectname> FROM <other .o's> <.o's> LIBRARY <libraries> <options>
  306.                                     (BLINK)
  307.  
  308. or  -o <projectname> <other .o's> <.o's> <libraries> <options>       (ln).
  309.  
  310.     This may help you to decide what options can meaningfully be used
  311.     with APE. For example, BLINK OVERLAY's are clearly unworkable.
  312.  
  313.     APE has some funnies in it to try to cope with the lack of a
  314.     battery-backed clock. Thus, hopefully, you don't need to set the time
  315.     each time you boot up, and APE's make facility can still cope.
  316.     However, this can make large projects rather slow to open and close.
  317.     Be patient.
  318.  
  319.     By and large, APE doesn't do a great deal of checking of user input
  320.     data. To avoid heartaches, give it sensible input. For example, source
  321.     file names should have a .c extension, and you shouldn't specify
  322.     circular dependencies.
  323.  
  324.     APE has a problem living with ConMan. You can't close the console
  325.     windows opened by APE if ConMan is installed. This gives the
  326.     appearance of a hung program. I hope to be able to work around this
  327.     somehow in the future.
  328.  
  329.     If you use a search path for commands then you will need to specify
  330.     this path in the SPECIAL menu. The path will be re-established each time
  331.     you edit, compile etc. This may cause "Please insert volume xxx"
  332.     requesters. My apologies, I haven't been able to find a better solution.
  333.     Assigns and sets are global and easier to handle. You can put these in
  334.     your startup-sequence or in each APE project. If you use assigns and
  335.     sets within APE, they will only be re-established when the project is
  336.     opened or when you alter them.
  337.  
  338.     There are doubtless a few bugs in v1.00, but not drastic ones
  339.     perhaps. For example, there is a memory leak somewhere. I am working
  340.     to fix those that I know of. Reports of other bugs and/or suggestions
  341.     for improvement will be gladly accepted.
  342.  
  343.  
  344.     RELEASE NOTES
  345.     -------------
  346.  
  347.     v0.95     Initial pre-release version.
  348.  
  349.     v0.96     Internal release. Many bugs fixed, printing added.
  350.          Code reorganised and recompiled with Lattice v4.01
  351.          resulting in 20% smaller code. Locations searched
  352.          for .apesrc and template files changed.
  353.  
  354.     v0.97     Internal release. Several bugs introduced with v0.96
  355.          fixed. File searching added ( FIND menu item ).
  356.  
  357.     v0.98     Internal release. RUN menu added. Command line arguments
  358.          to APE added. More reorganisation of code.
  359.  
  360.     v0.99     Internal release. Added support for non-blink syntax
  361.          linker. Added STACK size to menus. Improved requesters with
  362.          multiple string gadgets, and support for left-amiga v and
  363.          b in all requesters.
  364.  
  365.     v1.00     First release. Added PATH and QUIT menu items. APE window
  366.          shrinks when console window opens, expands when console
  367.          window closes. Menus disabled when performing actions,
  368.          enabled when actions completed. Other small bug fixes and
  369.          changes.
  370.  
  371.                         Philip Hingston
  372.                         9 September 1988
  373.  
  374.                         SofThing
  375.                         14 Waverley Rd,
  376.                         Chadstone, 3148,
  377.                         Victoria, Australia.
  378.  
  379. ==============================================================================
  380.  
  381.  
  382.     APPENDIX    REGEX     -    Regular Expressions Used in FIND menu item
  383.     --------    --------------------------------------------------------
  384.  
  385.     The core of this section of APE is a public domain implementation
  386.     of the regex regular expression package by Ozan. S. Yigit. This
  387.     appendix is an excerpt from his documentation.
  388.  
  389.  
  390. /*
  391.  * regex - Regular expression pattern matching
  392.  *       and replacement
  393.  *    .
  394.  *    .    { Note that replacement is not used in this version of APE. }
  395.  *    .
  396.  *
  397.  * By:    Ozan S. Yigit (oz)
  398.  *    Dept. of Computer Science
  399.  *    York University
  400.  *
  401.  *
  402.  * These routines are the PUBLIC DOMAIN equivalents
  403.  * of regex routines as found in 4.nBSD UN*X, with minor
  404.  * extensions.
  405.  *
  406.  * These routines are derived from various implementations
  407.  * found in software tools books, and Conroy's grep. They
  408.  * are NOT derived from licensed/restricted software.
  409.  * For more interesting/academic/complicated implementations,
  410.  * see Henry Spencer's regexp routines, or GNU Emacs pattern
  411.  * matching module.
  412.  *    .
  413.  *    .    { Section omitted here.}
  414.  *    .
  415.  *
  416.  * Regular Expressions:
  417.  *
  418.  *    [1]    char    matches itself, unless it is a special
  419.  *            character (metachar): . \ [ ] * + ^ $
  420.  *
  421.  *    [2]    .    matches any character.
  422.  *
  423.  *    [3]    \    matches the character following it, except
  424.  *            when followed by a left or right round bracket,
  425.  *            a digit 1 to 9 or a left or right angle bracket.
  426.  *            (see [7], [8] and [9])
  427.  *            It is used as an escape character for all
  428.  *            other meta-characters, and itself. When used
  429.  *            in a set ([4]), it is treated as an ordinary
  430.  *            character.
  431.  *
  432.  *    [4]    [set]    matches one of the characters in the set.
  433.  *            If the first character in the set is "^",
  434.  *            it matches a character NOT in the set. A
  435.  *            shorthand S-E is used to specify a set of
  436.  *            characters S upto E, inclusive. The special
  437.  *            characters "]" and "-" have no special
  438.  *            meaning if they appear as the first chars
  439.  *            in the set.
  440.  *            examples:     match:
  441.  *
  442.  *                [a-z]     any lowercase alpha
  443.  *
  444.  *                [^]-]     any char except ] and -
  445.  *
  446.  *                [^A-Z]     any char except uppercase
  447.  *                     alpha
  448.  *
  449.  *                [a-zA-Z] any alpha
  450.  *
  451.  *    [5]    *    any regular expression form [1] to [4], followed by
  452.  *            closure char (*) matches zero or more matches of
  453.  *            that form.
  454.  *
  455.  *    [6]    +    same as [5], except it matches one or more.
  456.  *
  457.  *    [7]        a regular expression in the form [1] to [10], enclosed
  458.  *            as \(form\) matches what form matches. The enclosure
  459.  *            creates a set of tags, used for [8] and for
  460.  *            pattern substitution. The tagged forms are numbered
  461.  *            starting from 1.
  462.  *
  463.  *    [8]        a \ followed by a digit 1 to 9 matches whatever a
  464.  *            previously tagged regular expression ([7]) matched.
  465.  *
  466.  *    [9]    \<    a regular expression starting with a \< construct
  467.  *        \>    and/or ending with a \> construct, restricts the
  468.  *            pattern matching to the beginning of a word, and/or
  469.  *            the end of a word. A word is defined to be a character
  470.  *            string beginning and/or ending with the characters
  471.  *            A-Z a-z 0-9 and _. It must also be preceded and/or
  472.  *            followed by any character outside those mentioned.
  473.  *
  474.  *    [10]        a composite regular expression xy where x and y
  475.  *            are in the form [1] to [10] matches the longest
  476.  *            match of x followed by a match for y.
  477.  *
  478.  *    [11]    ^    a regular expression starting with a ^ character
  479.  *        $    and/or ending with a $ character, restricts the
  480.  *            pattern matching to the beginning of the line,
  481.  *            or the end of line. [anchors] Elsewhere in the
  482.  *            pattern, ^ and $ are treated as ordinary characters.
  483.  *
  484.  *
  485.  * Acknowledgements:
  486.  *
  487.  *    HCR's Hugh Redelmeier has been most helpful in various
  488.  *    stages of development. He convinced me to include BOW
  489.  *    and EOW constructs, originally invented by Rob Pike at
  490.  *    the University of Toronto.
  491.  *
  492.  * References:
  493.  *        Software tools            Kernighan & Plauger
  494.  *        Software tools in Pascal    Kernighan & Plauger
  495.  *        Grep [rsx-11 C dist]        David Conroy
  496.  *        ed - text editor        Un*x Programmer's Manual
  497.  *        Advanced editing on Un*x    B. W. Kernighan
  498.  *        RegExp routines         Henry Spencer
  499.  *
  500.  *    .
  501.  *    .    { Section omitted here. }
  502.  *    .
  503.  *
  504.  * Examples:
  505.  *
  506.  *    pattern:    foo*.*
  507.  *    compile:    CHR f CHR o CLO CHR o END CLO ANY END END
  508.  *    matches:    fo foo fooo foobar fobar foxx ...
  509.  *
  510.  *    pattern:    fo[ob]a[rz]
  511.  *    compile:    CHR f CHR o CCL 2 o b CHR a CCL bitset END
  512.  *    matches:    fobar fooar fobaz fooaz
  513.  *
  514.  *    pattern:    foo\\+
  515.  *    compile:    CHR f CHR o CHR o CHR \ CLO CHR \ END END
  516.  *    matches:    foo\ foo\\ foo\\\  ...
  517.  *
  518.  *    pattern:    \(foo\)[1-3]\1  (same as foo[1-3]foo)
  519.  *    compile:    BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
  520.  *    matches:    foo1foo foo2foo foo3foo
  521.  *
  522.  *    pattern:    \(fo.*\)-\1
  523.  *    compile:    BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
  524.  *    matches:    foo-foo fo-fo fob-fob foobar-foobar ...
  525.  *
  526.  */
  527.