Short: GoldED4 online code indention V37.6 Author: mshopf@informatik.uni-erlangen.de (Matthias Hopf) Uploader: mshopf informatik uni-erlangen de (Matthias Hopf) Type: text/edit Version: 37.6 beta Architecture: m68k-amigaos COPYIGHT ©1997 Matthias Hopf. All rights reserved. Some routines are based partially on the public domain CLib package from Andreas R. Kleinert. Thanx! DISTRIBUTION This package is distributed as FreeWare under the GNU license. DESCRIPTION This is an API client for GoldED 4 that will scan all entered text and indent it according to its built-in rules. The scanner is quite versatile and will also report several types of syntax errors. Scanning will be done automatically when you press keys that could have implications on the indentation of the current line. There is a new ARexx command 'SMARTINDENT', too, with which you can explicitely start the intendation process. By default the installation script will map for the C-source filetype TAB to 'SMARTINDENT LINE', alt-TAB to 'SMARTINDENT BLOCK', shift-TAB and ctrl-TAB to 'TAB' and shift-ctrl-TAB to 'BACKTAB', so you don't lose the tabulator availability. Please note that the installer script does not yet create a 'smartindenting' Lisp source filetype. You will have to create it by hand. I suggest a filename pattern like "(#?.scm|#?.lisp|#?Install#?)". Source code is provided and almost cleaned up. I would love to add more indentation semantic parsers for other languages :^) If you like to create your own semantic parser, start with semantics_lisp.c - it is much simpler than the c-source semantics parser... Information about the used macros is provided in semantics.h, about the helper functions in util.h. ToDo: Still does some intentions not as I would like it to, but it's getting better. Better documentation needed. Configuration GUI (showing indentation of example source) needed. CURRENTLY KNOWN INDENTION MODES C (C and C++ source) Lisp (Lisp and derivates, e.g. Installer scripts) INSTALLATION Doubleclick at the installer script icon. It assumes that you already have the envCPP filetype package installed. For using Smartindent with Lisp source code you will at least have to create a Lisp GoldED type by hand and add Smartindent to the api configuration (arguments 'MODE Lisp'). Best configure TAB to invoke 'SMARTINDENT LINE' as well. SYNTAX: API startup arguments: Template: MODE/K,DEBUG/N/K,CONFIG/M/N/K MODE: Indention mode. When this argument is not specified or the given mode is unknown, a list of all known indention modes is shown in a requester. DEBUG: One nummeric argument that specifies the debug level (see util.h for more information) CONFIG: Currently 7 (or less) integer values that specify (in this order): - C-code Example: if (x) ....x = x+1; - Block indentation level (default 4) switch (x) ..{ - Brace indentation level (default 0, here: 2) x = x + 1; <- case 1: - Label indentation level (default -2) long int ..value; - Continued statement level (default 2) value = .0; - Continued equation level (default 1) ..../* xx */ - Standard comment level (default 4) x=0;..../* x */ - (Absolute) in-line comment level (default 40) - Lisp-code Example: ( ...function - Block indentation level (default: 1, here: 3) - Brace indentation level (currently unused) - Label indentation level (currently unused) - Continued statement level (currently unused) (function ...arg - Continued equation level (default 1, here: 3) ....; xx - Standard comment level (default 4) (xxx)....; x - (Absolute) in-line comment level (default 40) 'SMARTINDENT' command arguments: Template: LINE/S,LASTLINE/S,CURSOR/S,BLOCK/S LINE: Indent current line LASTLINE: Indent the line one above the current line CURSOR: Move cursor to last indentation position in this line BLOCK: Indent marked block BUGS Yes, there are some bugs left, but only according to wrong indented lines. So far smartindent V37.6 has not crashed my Amiga at all. Read the comment at the beginning of test_input.c and test_correct.c for more details. HISTORY V37.6 beta - Some more indention bug fixes: lines 164 166 178 181 198 of test_input.c are correct now. - Added 'Lisp' indention mode (e.g. for Installer scripts) - Corrected c semantics to more correctly interprete C++ code (bug-report: Henning Tietgens, thanx!) - Comments are no longer nested (bug-report: Marty King, thanx!) - Configuration is now window-dependend and no longer global - Some small other fixes V37.5 beta - Some more indention bug fixes. - Bug fix in endless loop detection. - Indenting code less often on pressing '/' or '*' now (only when necessary for comment indention). - Finally implemented routine dispatcher needed for multiple indention modes. V37.4 beta - Some indention bug fixes. Should recognize all C++ words now. V37.3 beta - Loads of bug fixes, one even potentially harmfull - 'test' smakefile target and test_input.c testing source file for checking indention abilities. V37.2 beta2 - Version information bug fixed. Installer should install the API-client correctly now. - Installer script reworked. - New regedit for installation process provided. Thanx Dietmar! V37.2 beta - First release.