home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / E2.ZIP / E_PC < prev    next >
Text File  |  1991-02-04  |  6KB  |  210 lines

  1.                  USING E ON THE PC
  2.  
  3.                   Mike O'Carroll
  4.  
  5.                              Microsystems Unit
  6.                             University of Leeds
  7.  
  8.  
  9.  
  10. 1.  INTRODUCTION
  11.  
  12. This note describes some of the features and limitations involved when run-
  13. ning  e2 on the PC.  The overall intention has been to make the functional-
  14. ity (ugh) as similar as possible  to  the  *ix  version,  but  restrictions
  15. imposed by DOS inevitably cause problems in certain areas.
  16.  
  17. It will be assumed that you are familiar with the general operation  of  e;
  18. if not, consult e_ref (D) and experiment.
  19.  
  20. 2.  SETTING UP
  21.  
  22. First get a copy of E2.EXE into your local \BIN directory which  should  be
  23. somewhere in the execution search PATH.  If you want the centering and jus-
  24. tifying filters, get copies of ECENTER.EXE and EFILL.EXE also.
  25.  
  26. All the other files should be placed in a suitable library  directory  such
  27. as \ELIB.  If you get the programs by downloading from the *ix system, make
  28. sure you use raw mode.
  29.  
  30. Next, set the TERM environment  variable  to  ibmpc2.   This  requires  the
  31. ANSI.SYS  driver;   although  this  slows  things down, it makes it easy to
  32. drive other terminals via the comms port.  Set the ELIB  environment  vari-
  33. able  to your library pathname.  Set the TMP variable to a temporary direc-
  34. tory and create the subdirectory ETMP in it.
  35.  
  36. All the above variables should incorporate the drive ID.
  37.  
  38. 3.  BACKUPS AND TEMPORARY FILES
  39.  
  40. Each time you change a file, a copy of the last version will be saved under
  41. the  name  %filename.  This corresponds to the "comma" file on the *ix ver-
  42. sion.  If the file name is already 8 characters (plus  extension),  e2 will
  43. warn  you  that  the  name is being truncated.  This warning is intended to
  44. prevent you from editing, say, longnam1.c and longnam2.c in the  same  ses-
  45. sion.  The results will not be pleasing!
  46.  
  47. Temporary files are called &*.tmp.  Most are removed on exit, unless  there
  48. is  a  crash,  though  a "state" file will remain and is used to restart an
  49. edit exactly as it was left;  simply type e2 without any arguments.
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                                    - 2 -
  68.  
  69.  
  70. 4.  FILTERS
  71.  
  72. The feed and run commands, and  by  implication,  fill,  just  and  center,
  73. mostly  work  under  DOS.  There can be problems with large files, and with
  74. external filters that are not "well behaved".  These should be  implemented
  75. by fork() and exec(), but have to be hacked under DOS.
  76.  
  77. If anything does appear to go wrong (screen gets scrambled,  etc),  do  not
  78. panic!  Exit from the editor and take a copy of your backup file (%*).  You
  79. may find that the file is still OK (it seems  that  just  the  screen  gets
  80. scrambled).   If not, simply copy the backup over the original and carry on
  81. from there.
  82.  
  83. If you do encounter problems with this, please inform the author.   Try  to
  84. give as full details as possible to aid bug hunting.
  85.  
  86. 5.  CARRIAGE RETURNS
  87.  
  88. End of line conventions differ from one system to another.  In  particular,
  89. DOS normally expects text files to have the sequence CR-LF rather than just
  90. LF;  owing to its origins, e2 uses the latter convention internally.
  91.  
  92. The default mode of e2 suppresses the display of CRs on the screen*.  A  CR
  93. flag at the bottom of the screen indicates this mode.
  94.  
  95. In its LF mode (no CR flag), e2 regards CRs as any other control character,
  96. and  will show them as *M (the * is actually a square block, but I can't do
  97. one on this terminal!).
  98.  
  99. You can of course get rid of them using rep:
  100.  
  101.       <ESC>rep /*M//<CR>
  102.  
  103. You enter control-chars by hitting control-\ (most PC keyboards), control-~
  104. or  control-`  (some  ATs  and  PS/2s),  followed  by  the character or its
  105. representation.  e.g. To enter a carriage return, type
  106.  
  107.       <control-\><CR>
  108.  
  109. or
  110.  
  111.       <control-\>M
  112.  
  113. You can put CRs on the end of every line using $ in RE (regular expression)
  114. mode.  e.g.
  115.  
  116.       <ESC>re<CR>
  117.       <ESC>rep /$/*M/<CR>
  118.  
  119. To switch from one mode to the other, use the command
  120.  
  121.       <ESC>cr<CR>
  122.  
  123. or
  124.  
  125.       <ESC>-cr<CR>
  126.  
  127. * This is the reverse of the earlier version, e.
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                    - 3 -
  140.  
  141.  
  142. as appropriate.  On the command line, you can use the the -lf flag to  turn
  143. off the default CR mode.
  144.  
  145. Remember that if you use the default mode to edit a  file  which  initially
  146. contains no CRs, e2 will insert them on exit.
  147.  
  148. 6.  FLOPPIES
  149.  
  150. Many people have come to grief when trying to use e2 (or one of its  ances-
  151. tors, v or e) to copy files from one diskette to another.  The procedure
  152.  
  153.       enter the editor
  154.       change the disk
  155.       save the file
  156.  
  157. seems a reasonable possibility*.  In fact, it is an almost, but not  quite,
  158. totally reliable method of scrambling both disks.
  159.  
  160. Why?  Well here in brief is how this type of editor works:
  161.  
  162. a)    First, it reads through the file and builds a linked  list  of  "file
  163.       segment  descriptors"  which  essentially define blocks of N lines in
  164.       the file.  Amongst other things, each descriptor contains pointers to
  165.       the byte offset of each file segment.
  166.  
  167. b)    When you enter editing commands, e2 modifies the linked list by  mov-
  168.       ing  pointers  and  changing the links, as you insert, move or delete
  169.       text.  If you add  text,  it  builds  a  keyboard  file  and  inserts
  170.       descriptors  which point to blocks in this.  If you window into other
  171.       files and pick out text blocks, again the list is modified.
  172.  
  173. c)    Note that the contents of the file are never "loaded into memory"  at
  174.       all, except for the local section on the screen|-.  Nothing happens to
  175.       the  original files until you hit ^Z.  Then, e2 "simply" runs through
  176.       the linked list and constructs a new  file.   The  original  file  is
  177.       renamed to form the backup.
  178.  
  179. The bottom line is that changing disks in the middle of all this completely
  180. invalidates  all the information held in the data structures, but of course
  181. e2 is none the wiser.  It simply reads what it thinks are the correct  bits
  182. and  pieces  and  writes them to what it thinks is the correct destination.
  183. This could be anywhere on the diskette.
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198. * Though why it should be more obvious than "copy" is beyond my comprehension.
  199. |- In fact, \fIe2\fR does a lot of caching for efficiency reasons, but this
  200. does not affect the general argument.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.