<html>
<head>
</head>

<body>

<pre>


########################################################################
########################################################################
########################################################################

Ceci sera la doc utilisateur  sur les electricAlias de stead83 :

A nettoyer (fortement) et  maintenir  jour.
    
diam 22/08/00
Nouveau principe pour la dfinition des alias en exploitatant le 
commande subst de TCL.
Ce nouveau principe est (pour l'instant) compatible avec l'ancien car
il permet d'exploiter les ancien alias (qui utilisent des caracters
speciaux dans leur dfinition. 

Voici l'ancienne syntaxe (toujours suporte) mais smantique non rcursive)
    set    tmp "${B}askalias {procedure name} NAME${E}"
    append tmp "## $V{NAME} -- $M\n"
    append tmp "# \n"
    append tmp "# \n"
    append tmp "# \n"
    append tmp "proc $V{NAME} \{$M\} \{\n"
    append tmp "${B}i${E}$M\n"
    append tmp "\}\n"
    append tmp "$M"
    electricAlias-def ${M}tcl procold $tmp

Voici la nouvelle syntaxe :
   
    set    tmp {[askVar "procedure name" NAME]}
    append tmp {## [getVar NAME] -- [setStop]\n}
    append tmp {# \n}
    append tmp {# \n}
    append tmp {# \n}
    append tmp {proc [getVar NAME] { [setStop] } \{\n}
    append tmp {[i][setStop]\n}
    append tmp {\}\n}
    append tmp {[setStop]}
    electricAlias-def ${M}tcl proc $tmp


Le but est de demander  l'utilisateur le nom d'une procdure, et
d'insrer la chaine suivante (tout en conservant la chaine d'indentation 
totale de la ligne courante) :

    ## NAME -- 
    # 
    # 
    # 
    proc NAME {  } {
        
    }

Commande d'alias utile :
------------------------
askVar NAME   
    (alias de electricAlias-askVar) 
    demande une chaine  l'utilisateur est la mmorise (en interne)
    sous le nom pass en argument

getVar
    (alias de electricAlias-getVar) 
    restitue cette variable

setStop
    (alias de electricAlias-setStop) 
    positionne une markque de stop qui permet de naviguer d'un champs 
     l'autre (par "Control-Tab")

i  (procdure de stead)
    retourne l'indentation courant

En fait toute commande ou variables globales peuvent dsormais etre 
utilise dans une dfinition d'alias.


########################################################################
########################################################################
########################################################################

Extrait de l'ancien manuel :

QUICK START

'electricAlias' is a general-purpose Tcl package that provides a 
flexible way to automate entering repetitive text. This text can be as 
simple as the current date, or can be a template containing many entry 
points where additional data is added. In this case, 'electricAlias' 
inserts the boilerplate and provides a convenient way to jump between 
entry points. Using electricAlias is as simple as typing a key word and 
hitting the tab key. 

    The following instructions will get you up and running ASAP. You will
    have three new bindings: 
    *1. <Meta-Space> will be bound to 'electricAlias-insert' and 
    *2. <control-tab> will be bound to 'nextStop', which jumps you to the 
       next entry point in the current aliased text.
    *3. <control-shift-j> is bound to 
       'prevStop', which jumps you to the previous entry point. 

    To use, simply place this file place in a folder named 
    $HOME:Tcl:ElectricAlias: and append:

            'source $HOME:Tcl:ElectricAlias:electricAlias.tcl' 

    to AlphaBits.tcl. Also create a folder named 
    $HOME:Tcl:ElectricAlias:Aliases and make sure to place at least a file 
    named 'Aliases' in it with your default aliases. If you wish to use the
    language extensions feature, place respective files 'Aliases.Tcl', 
    'Aliases.C', etc.. there as well. 

    To invoke in the current session you may manually source/load
    it yourself; otherwise, quit and relaunch Alpha.

    Now go read about TEMPLATES below and examine the aliases files
    to understand how it all fits together.

GENERAL USAGE


    ElectricAlias is simple to use.  Normally it is bound to the
    "Tab" (ou "Shift-Tab" character, so you just type away.  You define aliases
    in file steadrc

TEMPLATE DEFINITIONS


  electricAlias-def MODE NAME ?DEFINITION?

  Defines or displays an alias template.  If DEFINITION
  is omitted and the alias exists, then the current
  definition is returned per TCL 'return'.
  
  Aliases may have embedded variables, TCL commands, stops,
  line-ends and deletes as described under TEMPLATES below.

  If MODE begins with a bullet (), then the alias is only effective
  when used as the first token on a line.


  Templates provide a mechanism for inserting text with temporary stops.
  Facility is also provided to preserve indentation and allow for alias
  variable insertion and TCL commands.  This is accomplished with special
  character sequences embedded within the template.  Hopefully, none of
  these are needed in the inserted text itself. 
    
  Here are the definitions:

  \b          deletes one character to the left.  Useful for outdenting.

   (xa5)     inserts a temporary mark (global variable EA_8bit_mark)

  CMD      inserts the results of executing the TCL command CMD.  Be
  (a4 c7 c8)  careful if your command contains anything that would be
  	      construed as part of a regular expression.  To be safe use
              only single procedures with simple arguments.  Also, the CMD
              may not contain a closing ''.

              It is possible for CMD's to be recursive (subject to the 
              same restrictions above) or include {VAR}'s.
              global variables EA_8bit_begin and EA_8bit_end

  {VAR} (a4) inserts an alias variable (IMPORTANT: inserted AFTER CMD's)
              It is possible for {VAR}'s to be recursive or include 
              CMD's (subject to the CMD restrictions above).
              global variable EA_8bit_var

  \r        inserts a new-line break and cues procedure to preserve 
            indentation if alias mode is bullet type or when called 
            explicitly.

  \n        identical to \r

  \t        inserts a tab for indentation

  Other escapes are as defined by TCL

  You can trick templates to insert some of the above with the following;
  although, why you would want to is beyond me.
  
  '\ \bb' inserts literal '\b'
  ' \bCMD' inserts literal 'CMD'
  ' \b{VAR}' inserts literal '{VAR}'
  
  
  En rsum, on dispose des variables suivantes 
  
                            EA_8bit_mark   : 
                            EA_8bit_begin  : 
                            EA_8bit_end    : 
                            EA_8bit_var    : 
  pour les electric alias
  
  La premiere possede deux significations :
  
    1-place avant le nom du mode dans la dfinition d'un electric alias, elle
      signifie que l'alias ne sera reconnu que s'il est le premier mot de la
      ligne : 
    2-au sein de la dfinition de l'electric alias elle insre une marque
      temporaire pour le navigation au sein de l'alias tendu
  Exemple :
   electricAlias-def C while   "while ()\r  {\r\t\r  }\r"
   1-l'alias "while" pour le mode C ne sera etendu que s'il est le premier mot 
   de la ligne car "C" est prcd de 
   2-trois marques  sont insres aprs extension de l'alias while.
   Ce caractre huit bits n'tant pas accessible au clavier, on peut crire :
   set M $EA_8bit_mark
   electricAlias-def [set M]C while   "while ($M)\r  {\r\t$M\r  }\r$M"
   
  La seconde et la troisime entourent l'appel d'une procdure dans un electric 
  alias
  
  La quatrime permet la dfinition d'une variable propre aux lectric Alias


SIMPLE EXAMPLES

    The following examples show several templates that might be appropriate
    for the C programming language:
    
    electricAlias-def C while   "while () {\r\t\r}/*endwhile*/"
    electricAlias-def C for     "for (;;) {\r\t\r}/*endfor*/"
    electricAlias-def C if      "if () {\r\t\r}/*endif*/"
    electricAlias-def C elseif  "\b} else if () {\r"
    electricAlias-def C else    "\b} else {\r"

    Suppose that the user has an open window for MYFILE.C (please bear
    with the poor graphics):
    +-------------------
    | MYFILE.C
    +-------------------
    |
    +-------------------

    By typing 'while\t' this would insert:
    
    +-------------------
    | MYFILE.C
    +-------------------
    |while () {
    |	
    |}/*endwhile*/
    +-------------------
    
    The cursor would be positioned inside the parentheses ready for an
    expression to be typed.  When done with the expression, the user would
    press CONTROL-J to jump to the next position where the body of the
    WHILE loop would be entered.  A final CONTROL-J would position the user
    just after the /*endwhile*/ comment.
    
    For this example, suppose the user types 'i < 5';

    Suppose the user type 'if\t' inside the body of the while, then we
    would get:

    +-------------------
    | MYFILE.C
    +-------------------
    |while (i < 5) {
    |	if () {
    |		
    |	}/*endif*/
    |}/*endwhile*/
    +-------------------

    For the IF conditional suppose the user typed '*c != 0'.
    Now in the body of the IF the user enters 'a = 1;else\ta = 2' and gets:
    
    +-------------------
    | MYFILE.C
    +-------------------
    |while (i < 5) {
    |	if (*c != 0) {
    |		a = 1;
    |	} else {
    |		a = 2;
    |	}/*endif*/
    |}/*endwhile*/
    +-------------------

    Suppose you don't like my indentation style for C.  Perhaps the 
    following definitions and the resulting code would be more suited to
    your tastes:

    electricAlias-def C while   "while ()\r  {\r\t\r  }\r"
    electricAlias-def C for     "for (;;)\r  {\r    \r  }\r"
    electricAlias-def C if      "if ()\r  {\r    \r  }\r"
    electricAlias-def C elseif  "\b\b}\r\b\b\b\belse if ()\r\b\b{\r"
    electricAlias-def C else    "\b\b}\r\b\b\b\belse\r\b\b{\r"

    Now MYFILE.C would look like this:
    
    +-------------------
    | MYFILE.C
    +-------------------
    |while (i < 5)
    |  {
    |    if (*c != 0)
    |      {
    |        a = 1;
    |      }
    |    else
    |      {
    |        a = 2;
    |      }
    |   
    |  }
    +-------------------


########################################################################
########################################################################
########################################################################

Conception : extrait du fichier original :


# electricAlias uses a single array ALIAS to store all of its data. Aliases 
# themselves are stored as ALIAS(mode,name). This means that commas are not 
# allowed in mode names (not a severe restriction). State information is 
# stored in ALIAS(name). 
# 
# To make it easier to undo an unintentional template, insertText is called
# once with the normal insertion of a space.  If a template succeeds, then the
# matched word is replaced.  To get back to the plain insertion, just UNDO
# (CMD-Z) twice!  To undo all the way you need one more undo.
#
# Also, if text is selected then the template checking is always abandoned
# in favor of a real space.
# 
# WARNING: If binding to another key is desired, be sure to change the
# definition of $bindKey appropriately.
#
# Use of the bullet () to flag stops was arbitrary to some extent.  It had
# to be something easy to use, but not a normal part of programming languages.
# It also needed to be something that would not need special escaping in a
# regular expression.  The same is true for alias variables.

    
########################################################################
########################################################################
########################################################################
    Copyright d ela version originale profondment modifier
    
AUTHOR

      David C. Black
      Internet: black@mpd.tandem.com (preferred)
      GEnie:    D.C.Black
      USnail:   6217 John Chisum Lane, Austin, TX 78749

COPYRIGHT:

      Copyright  1992,1993 by David C. Black
      All rights reserved.

      Redistribution and use in source and binary forms are permitted
      provided that the above copyright notice and this paragraph are
      duplicated in all such forms and that any documentation,
      advertising materials, and other materials related to such
      distribution and use acknowledge that the software was developed
      by David C. Black.

      THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
      IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

</pre>


</body>

</html>












