home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / DEOS2.ZIP / ALIAS.DOC < prev    next >
Text File  |  1988-02-22  |  9KB  |  211 lines

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