home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 613b.lha / VIF / vif.e.doc.pp / vif.e.doc
Encoding:
Text File  |  1992-03-07  |  7.6 KB  |  236 lines

  1. VIF.
  2.  
  3.  _V_ery _I_ntelligent _F_ilter
  4.  
  5.  C1990 Pagani Massimiliano
  6.  
  7.  
  8. 0 DISTRIBUTION RULES
  9.   You can freely copy this program and give a copy to anyone, only if you
  10. don't charge and if you give all files relative to VIF.
  11.   You are allowed to put VIF and its files on a BBS or in public domain and
  12. share ware collections (as Fred Fish one).
  13.   It's forbidden modifing the files vif.e.doc, vif.c without my written
  14. consense.
  15.   Again, the diffusion of this program will have to be free gifting.
  16.   The Author is not responsible of data damages/losses deriving from using
  17. correctly, or not, the VIF program.
  18.  
  19.   OK I think that's enough, let's go...
  20.  
  21. 0.1 Files
  22. Distributions files are:
  23.  
  24.     VIF        - the executable (13364 bytes)
  25.     VIF.c        - the source code (10819 bytes)
  26.     VIF.doc        - italian version of this doc (9801 bytes).
  27.     VIF.e.doc    - this English doc (7794 bytes).
  28.  
  29. If you can't find all these files, you can contact me to get the last
  30. version (my address is at the end of this file)
  31.  
  32.  
  33.  
  34. 1 WHAT DOES VIF DO?
  35. VIF is a filter. It takes an input text file and outputs another text file.
  36. During this operation VIF removes all useless characters. (We'll se in a
  37. while what are useless chars).
  38. This program has come out from the need of archiving, in an organic way, a
  39. great number of documents. Before I wrote VIF, I had to use a text editor
  40. to do the same job with a great amount of patience.
  41. You can run VIF only from CLI. To use VIF you have to know at least
  42. something of AmigaDOS.
  43.  
  44.  
  45.  
  46. 2 WHICH CHARACTERS ARE REMOVED BY VIF?
  47.  
  48. 2.1 Spaces -> tabs
  49. A tab char allows to gain from 1 to 7 chars. Example:
  50.  
  51. T-------T-------T-------T-------T-------T-------T-------T-------T
  52. __some_characters__________________other_characters.
  53.  
  54. In the first line i've pointed out the tabulations (one every 8
  55. characters). In the second line an example of text where '_' represents the
  56. space character.
  57. After VIF processing the second line became:
  58.  
  59. T-------T-------T-------T-------T-------T-------T-------T-------T
  60. __some_characters<T>    <T>    ___other_characters.
  61.  
  62. Where <T> shows a tab char. You can see that the spacing between words is
  63. the same as before, but now you use 13 character less.
  64.  
  65.  
  66. 2.2 Spaces and tabs before the end of line.
  67. Invisible characters (spaces and tabs) just before the end of a line are
  68. useless since you can't see them and they don't contribute to any spacing,
  69. then they will be removed without fear.
  70.  
  71.  
  72. 2.3 Newlines before the end of file.
  73. Like spaces and tabs of the point 2.2 lines at the end of file are of no
  74. use to anyone.
  75. VIF is quite intelligent (!) in this cases: if there are some empty lines
  76. and one of these contains only spaces and tabs, this will be considered
  77. empty and will be removed.
  78.  
  79.  
  80. 2.4 Spaces covered by tabs
  81. Here is an example:
  82.  
  83. T-------T-------T-------T-------T-------T-------T-------T-------T
  84. __<T>    some characters
  85.  
  86. The first two spaces are useless since they are "covered" by the tab that
  87. follows them.
  88.  
  89.  
  90. 2.5 ^M e ^Z
  91. Messy Dossy computers use memory hungry conventions about text files - to
  92. end a line they use two characters, one to return carriage at the beginning
  93. of line (carriage return) and one to move down to the next line (line
  94. feed).  Amiga (and many other computers) does the same with only one
  95. character.  In few words at the end of the line you can find ^J^M, but only
  96. ^J is needed.
  97. Another useless character is ^Z which, again in messy dossy systems, marks
  98. the end of the file.
  99.  
  100.  
  101. 2.6 Optionally escape sequences.
  102. Optionally you can remove escape sequences, i.e. characters sequences which
  103. begin with ^[ (escape), then [ (or character 0x9B instead of these two),
  104. followed by other chars.
  105. These special codes are used to change color, graphic rendering (bold,
  106. underline, italic), cursor position and for other operations.
  107. If you print the ascii file with a "type" command you'll see these changes
  108. correctly, but if you use an editor or a "more"-like command, it's easy
  109. you'll see garbage.
  110.  
  111.  
  112.  
  113. 3. USAGE
  114. As I pointed out before, VIF works ONLY from CLI, this means no friendly
  115. user interface. May be one day, for a future release...
  116. There are some ways to invoke VIF. To get some help from VIF itself
  117. it is sufficent to type:
  118.  
  119. 1> vif ?
  120.  
  121.  
  122. 3.1 Options
  123. In every way you use VIF, you can specify some options as follows:
  124.  
  125. 1> vif -<letters>
  126.  
  127. Currently supported options are:
  128. -e    Keep escape sequences
  129. -q    Quiet mode: no writings.
  130. -p    Every 16 lines read, vif print a '#'.
  131. These options can be combined together simply specifing more than a letter
  132. after the '-'.  [For example to keep escape sequences and to show that
  133. something is going on, you have to use:
  134.  
  135. 1> vif -ep
  136.  
  137. N.B.
  138. 1> vif -e -p
  139. Doesn't work (at present, may be one day...)]
  140.  
  141.  
  142. 3.2 From stdin to stdout.
  143. This is the first and the simplest way of working of VIF. It takes its
  144. standard input, and put the filtered result in the standard output.
  145. This system is usefull when using pipes and redirections.
  146. To invoke VIF for this case you have to specify:
  147.  
  148. 1> vif
  149.  
  150. Eventually followed by some options. Option -q is automatically activated,
  151. while option -p is disabled.
  152.  
  153.  
  154. 3.3 From a file to another one
  155. Syntax is:
  156.  
  157.   vif [-epq] source_file destination_file
  158.  
  159. destination_file will be created. If there is another file named like
  160. destination_file is, it will be deleted.
  161.  
  162.  
  163. 3.4 From a file to itself.
  164. The result of the filtering is put in a temporary file, at the end of the
  165. operation, this file is copied onto the original one.
  166. Syntax is:
  167.  
  168.   vif [-epq] file
  169.  
  170. Temporary file is named t:viftemp%d. Where %d is for an integer number.
  171. Of course you need device t: assigned otherwise you will get the request
  172. to insert volume T in any drive.
  173. VIF checks if this file exists, if the check result is positive VIF
  174. increments the number until it finds a non-existant file.
  175. I think that's important to notice that VIF doesn't work directly on the
  176. file, indeed you can always recover data if an error should occour.
  177.  
  178.  
  179. 3.5 Warning
  180. Pay attention when you invoke VIF on a source code. In fact VIF doesn't
  181. know anything about language syntax. Say you have the line:
  182.  
  183. T-------T-------T-------T-------T-------T-------T-------T
  184.                             
  185.   printf("hello boy!\n");
  186.  
  187. VIF will translate the space between `hello' and `boy' with a tab char,
  188. because `boy' is on a tab boundary. When you compile the source and run the
  189. executable, you will get:
  190.  
  191. hello    boy
  192.  
  193. Three space instead of one
  194.  
  195.  
  196. 4 SOON ON THESE SCREENS
  197. I have some ideas on VIF evolution. Actually I have other programs to write,
  198. but if VIF gives me some satisfaction I will go on and implement the
  199. following options:
  200. - Paragraphs formatting with or without fill.
  201. - Accented vowels substitutions: e' -> รจ (useless for english people, sorry).
  202. - User interface for batch operations.
  203. - Comments and useless spaces removal from C source code.
  204. - paging.
  205.  
  206.  
  207. 5 SOME ENDING NOTES
  208. To realize VIF I've used all good programming rules learned at school and
  209. on the work field, indeed I think that there shouldn't be ANY problem. I've
  210. tested VIF on 6 Mbytes of docs in multitasking (i.e. while doing other
  211. things on the computer) and I got no problems.
  212. Always you can recover data integrally (but when you use VIF from stdin to
  213. stdout).
  214. Actually VIF is NOT a pure program, it means that you can't load VIF as
  215. resident and use it from more than one process. If I'll get enough request
  216. to make VIF pure, I'll search the docs on pure programs and I'll turn it
  217. pure.
  218.  
  219. If you use VIF and you think that is a good useful program and you want to
  220. contribute to software developement ($$), or you have discovered an
  221. interesting way to get a GURU with VIF, or you have any suggestions, my
  222. address follows:
  223.  
  224.     Pagani Massimiliano
  225.     via Mazzini 40
  226.     21052 Busto Arsizio (VA)
  227.     ITALY
  228.  
  229. For the previous last things you can contact me with e-mail at:
  230.  
  231.     ele0001@cdc835.cdc.polimi.it
  232.  
  233.     [The address is equal to 131.175.6.2]
  234.  
  235. Thanx and enjoy.
  236.