home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / text / edit / FrexxEdA.lha / FrexxEd / fpl / CIndent.FPL.README < prev    next >
Text File  |  1995-09-06  |  3KB  |  88 lines

  1. ############################################
  2. File: CIndent.FPL
  3. Author: Linus Nielsen
  4. Email: emwnie@emw.ericsson.se
  5. Short description: Performs an automatic C-language indentation
  6. Version: 1.4
  7. Date: 30.8.95
  8. Local settings:
  9.  "c_indent_mode", BOOLEAN    TRUE when the mode is active
  10.  "c_indent_level", INTEGER    The normal indent level.
  11.  "c_case_level", INTEGER    Indent level for 'case' & 'default' lines.
  12.  "c_brace_offset", INTEGER    Offset for the lines containing a brace.
  13.  "c_cont_offset", INTEGER    Line continuation level.
  14.  "c_usetabs", BOOLEAN        TRUE for optimal filling with TAB.
  15.  
  16. Global settings:
  17.  "c_intelligence", CYCLE    The search depth for the indentation analysis.
  18.                  Can be "Stupid", "Smart" or "Ninja".
  19.  "c_indentkey", STRING        The key to use for forced indentation.
  20.  "c_delay", INTEGER        The number of ticks to wait when matching
  21.                  parentheses.
  22.  
  23. Keysequence:
  24. Type: Minor Mode, hook, key
  25. Prereq:
  26. ############################################
  27.  
  28. FUNCTION
  29.   This script handles automatic indentation of C code. The following is handled:
  30.   
  31.   - When you press 'Return', it analyses the previous lines to determine the
  32.     indentation level and automatically indents the next line.
  33.     
  34.   - When you press '}', it moves it to the right level.
  35.   
  36.   - When you press ':' right after 'case' or 'default', it moves the line to the
  37.     right level.
  38.     
  39.   - When you press ')' or ']' it shows the matching '(' or '['.
  40.   
  41.   - When you type '*/' (the end of a comment), it shows you the matching '/*'.
  42.   
  43.   - When you type '#' as the only non whitespace character on a line, it moves
  44.     it to the beginning of the line (for #define and #ifdef).
  45.  
  46.   - If for some reason the automatic indentation fails, press the 'force indent'
  47.     key to reanalyse. Useful if an indentation level has been removed, or when
  48.     cutting and pasting from different levels.
  49.     
  50.     
  51.     How to enable CIndent.FPL
  52.     -------------------------
  53.     
  54.     Use FMC.FPL, and make your Major Mode set 'c_indent_mode' to 1 when a 
  55.     'c', 'fpl' or 'h' file is loaded. See FMC.FPL.README for information.
  56.  
  57.     
  58. HISTORY
  59.   1.1    Fixed bug that caused TAB characters to disturb the indentation
  60.     check.
  61.   1.2    Fixed an even more stupid bug which caused the indentation to
  62.     fail in the first column.
  63.   1.3    Replaced the enter key to return.
  64.   
  65.   1.4    Completely rewritten, ripping some ideas from Jesper Skov's
  66.       CIndentMode.FPL script. Now it is much more intelligent.
  67.  
  68. BUGS
  69.  
  70. EXAMPLE (added by Daniel Stenberg)
  71.    The following little snippet is Linus' own CMode.FPL file:
  72.  
  73. ------------------------------8<------------------------------------
  74.    //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» CModeInit() ««
  75.    void export CModeInit()
  76.    {
  77.       SetInfo(-1, "c_indent_mode", 1);
  78.    }
  79.    
  80.    //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» CMode settings ««
  81.    ConstructInfo("c_mode", "","", "LBH","", 0,0,0);
  82.    ConstructInfo("c_mode_ext", "","", "GSHW","", 0,0,"*c*h*fpl*");
  83.    ConstructInfo("c_mode_exe", "","", "GSHW","", 0,0,"CModeInit();");
  84.    
  85.    AddMode(1, "c_mode", "c_mode_ext", "c_mode_exe");
  86. ------------------------------8<------------------------------------
  87.  
  88.