home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / ALIV11.ZIP / ALIAS.DOC < prev    next >
Text File  |  1988-03-21  |  10KB  |  262 lines

  1.  
  2.  
  3.                 ALIAS
  4.                    ver. 1.1
  5.                Andrew D. Estes
  6.                948 Sunridge Dr.
  7.              Sarasota, Fl. 34234
  8.                 (813) 355-3140
  9.             Compuserve 73076,2737
  10.                 March 13, 1988
  11.  
  12.  
  13.  
  14.                  INTRODUCTION
  15.  
  16.  
  17.     As I began doing development work under OS/2 I suffered from the
  18. loss of many of the utilities that I was accustomed to using under
  19. DOS.  Consequently, my first task was to build OS/2 versions of these
  20. programs.  This is the first of this set of OS/2 utilities.
  21.  
  22.     As this is a program that was written for educational purposes as
  23. well as personal use, the documentation is sparse.  It assumes some
  24. familiarity with programs such as CED and with OS/2.  This must also
  25. be considered an experimental program.  It has been tested, but I
  26. would not consider it to be a production quality program by any means
  27. This is not to imply that this may be a dangerous program (OS/2 makes
  28. it very difficult to create a program that can damage the system),
  29. only that the user interface is weak and that there may be situations
  30. in which the program does not work exactly as expected. If you should
  31. find any of the cases, please contact me and I will try to correct
  32. the situation.
  33.  
  34.     This is a free program.  I am placing no restrictions on its use
  35. or distribution.  I do ask that this documentation be attached so
  36. that users will have a means of contacting me with problems.
  37.  
  38.  
  39.  
  40.     The ALIAS package consists of three files:
  41.  
  42.     ALIAS.DOC    - this file.
  43.     ALIAS.EXE    - the controlling program.
  44.     ALIAS.DLL    - a dynalink library containing the alias subsystem.
  45.     KEYSTRIN.ASM - asm source for the keyboard replacement subsystem
  46.                    and alias functions.
  47.     ALIAS.C      - source for the alias driver program.
  48.     ALIAS.DEF    - linker definition file.
  49.     ALIAS        - make file for the system.
  50.                 
  51.  
  52.  
  53.  
  54.                 A FEW DETAILS
  55.  
  56.  
  57.     ALIAS works by registering a replacement for the KBDSTRINGIN
  58. function of the KBD subsystem.  This replacement function is
  59. contained in the ALIAS.DLL file.  When a program calls KBDSTRINGIN,
  60. the KBD function dispatcher notes that a replacement function has
  61. been registered and directs the call there rather than to the
  62. standard function.  This replacement function adds command recall,
  63. command editing, and alias replacement to the normal KBDSTRINGIN. 
  64. There are two limitations to this approach.  First, a KBD replacement
  65. function is only active in the screen group in which it was
  66. registered.  This means that if you then switch to another screen
  67. group, you will be using the standard (non-alias) KBDSTRINGIN
  68. function.  Second, only one replacement function is allowed per
  69. screen group.  If another process tries to register a new function,
  70. OS/2 will fail the request.
  71.  
  72.     Since each session must register ALIAS, I decided that each
  73. session should have its own recall stack.  This was implemented by
  74. marking one data segment as nonshared.  Thus you should not expect to
  75. be able to recall commands from one session while in another.  (In
  76. future versions, I may allow shared recall).
  77.  
  78.     On the other hand, I did not want to have to redefine aliases for
  79. more than one session.  In this case, I defined the segment which
  80. holds alias/replacement strings to be a shared segment.  If you
  81. define an alias in session 1, that alias will then be active in
  82. session 2 (assuming of course, that the ALIAS subsystem is active in
  83. session 2).
  84.  
  85.     Since ALIAS is a dynalink library, OS/2 must know where the DLL
  86. file exists.  When loading a DLL, OS/2 looks along the path defined
  87. by the LIBPATH variable.  When installing ALIAS, make sure that
  88. ALIAS.DLL is put somewhere along this path.
  89.  
  90.  
  91.  
  92.  
  93.               LOADING AND RUNNING ALIAS
  94.  
  95.  
  96.     To load ALIAS, simply run ALIAS.EXE with no parameters.  This
  97. will register the replacement KBDSTRINGIN function for the current
  98. session (screen group).  If you run ALIAS.EXE a second time with no
  99. parameters, you will receive an error message reporting that the
  100. function can not be registered.
  101.  
  102.     The base ALIAS system allows command recall and editing similar
  103. to that found in CED.  I tried to follow the keyboard functions
  104. defined in CED as much as possible.  All commands entered on the
  105. command line are stored in a circular buffer.  These commands may be
  106. recalled using the up and down arrow keys.  Command line editing is
  107. also implemented.  The editing keys include:
  108.  
  109.    LEFT ARROW  - move the cursor left one character
  110.    RIGHT ARROW - move the cursor right one character
  111.    HOME        - move the cursor to the beginning of the line
  112.    END         - move the cursor to the end of the line
  113.    CTL-RIGHT   - move the cursor to the start of the next word
  114.    CTL-LEFT    - move the cursor to the start of the previous word
  115.    INSERT      - toggle insert mode
  116.    DELETE      - delete the character at the cursor
  117.    BACKSPACE   - delete the previous character
  118.    ESC         - clear current command line
  119.  
  120.     I also replicated the standard DOS / OS/2 function key template
  121. editing.  Note that these only work on the last command, not on
  122. recalled commands.
  123.  
  124.     Finally, CTL-PAGEUP will clear the recall buffer and CTL-PAGEDOWN
  125. will remove the current line from the recall buffer.
  126.  
  127.     Command aliasing takes place when a line begins with a character
  128. string that has been designated for replacement.  Such a string may
  129. be recorded as follows:
  130.  
  131.     ALIAS cv cvp /43
  132.  
  133. The effect of this line will be that any time the KBDSTRINGIN
  134. replacement function sees a line that begins with 'cv ...' it will
  135. expand that line into 'cvp /43 ...' immediately before returning the
  136. line to the calling program.  You will not see the replacement line
  137. echoed to the screen; only the function that called KBDSTRINGIN will
  138. see the expanded line.
  139.  
  140.     If you wish to record multiple aliases, you may create a file
  141. containing the alias strings one per line.  To load the file invoke
  142. ALIAS with a '-f filename':
  143.  
  144.     ALIAS -f alias.cfg
  145.  
  146. ALIAS will then read the file alias.cfg and record the alias strings. 
  147. You may clear the alias string buffer by invoking ALIAS with a '-c'
  148. parameter:
  149.  
  150.     ALIAS -c
  151.  
  152. ALIAS will clear all defined aliases.  If you wish to redefine a
  153. replacement string, simply enter the replacement as if it were a new
  154. alias:
  155.  
  156.     ALIAS cv cvp /s
  157.  
  158. ALIAS checks each alias entered against all previously registered
  159. alias strings.  If the source portion matches a defined alias, the
  160. entire alias replacement string is replaced.  You may undefine an
  161. alias by simply not having a replacement string:
  162.  
  163.     ALIAS cv
  164.  
  165. ALIAS sees that there is no replacement string and clears the 'cv
  166. ...' string from its alias buffer.  Finally, you may list all defined
  167. alias replacement stings by running ALIAS with a '-l' option:
  168.  
  169.     ALIAS -l
  170.  
  171. ALIAS will then list to STDOUT (i.e. it may be redirected) all
  172. defined alias strings.
  173.  
  174.  
  175.  
  176.  
  177.               KNOWN LIMITATIONS
  178.  
  179.  
  180.     Since the ALIAS.EXE program terminates after registering the
  181. KBDSTRINGIN replacement function, it is not possible to de-register
  182. the function (OS/2 only allows the registering process to de-register
  183. a replacement function).  This means that if you do not wish ALIAS to
  184. be active, you must shut down the session in which it was loaded and
  185. start another session without loading it.  As there are not as yet
  186. many OS/2 programs, it is hard to determine if this is a real
  187. problem.  I tend to think it is not.  The replacement KBDSTRINGIN
  188. function will pass control back to the normal KBDSTRINGIN function if
  189. it does not like the state of the keyboard or if it is called with a
  190. NOWAIT option.
  191.  
  192.     As a side effect of the NONSHARED data segment, each process will
  193. also have its own recall stack.  This is similar to the DOS and
  194. APPLICATION command stack ideas of CED.
  195.  
  196.     Control character expansion is not performed.  Thus a tab
  197. character is NOT expanded; in fact, a tab is simply ignored.  Other
  198. control characters are displayed using the graphics characters rather
  199. than the standard ^character form.
  200.  
  201.     The command recall buffer and the alias buffer are both set at
  202. 2048 characters.  These settings can not be changed.  The command
  203. recall buffer is a circular buffer; earlier commands are simply
  204. overwritten.  The alias buffer is simply a list.  If the buffer would
  205. be overflowed by adding a new alias, the new alias will not be
  206. accepted and you will receive an error message.
  207.  
  208.     There is a problem with loading an alias from the OS2INIT.CMD in
  209. the first session.  Specifically, if you have a line which loads an
  210. alias, this alias is lost after exit from the CMD file.  Alias
  211. loading will work in other sessions.
  212.  
  213.     ALIAS is a purely OS/2 program.  It does not work under DOS or
  214. the DOS 3.x box.
  215.  
  216.     ALIAS has only been tested on the Microsoft SDK version of OS/2. 
  217. It should work on any other versions, but if not please let me know.
  218.  
  219.  
  220.  
  221.  
  222.                CHANGES IN THIS VERSION
  223.  
  224.  
  225.     This version includes the source code.  This was included so
  226. interested parties could see how a replacement subsystem could be
  227. written.  
  228.  
  229.     The 101-key keyboard is now supported.  In the previous version I
  230. did not properly recall the last command if it were itself a recalled
  231. command.  This is now fixed.  The backslash character is now
  232. considered a word delimiter.  This is useful when correcting spelling
  233. errors in pathnames.
  234.  
  235.  
  236.  
  237.  
  238.                 FUTURE
  239.  
  240.  
  241.     I think that I shall include a VIOPOPUP window for command
  242. recall.  It will probably be a few weeks before I have time to do so,
  243. so if you have any other suggestions that should be implemented,
  244. please send them along.
  245.  
  246.  
  247.  
  248.  
  249.                ACKNOWLEDGEMENTS
  250.  
  251.  
  252.     It should be obvious that this program was heavily influenced by
  253. the excellent program CED by Chris Dunford.  CED is one of those
  254. programs that made working in DOS acceptable.  I only hope that this
  255. program will be as half as useful.
  256.  
  257.     ALIAS consists of approximately 2000 lines of assembler code for the
  258. dynalink library and approximately 200 lines of C code for the driver
  259. program.  The program was written using the Microsoft OS/2 SDK.
  260.  
  261.  
  262.