home *** CD-ROM | disk | FTP | other *** search
- VIF.
-
- _V_ery _I_ntelligent _F_ilter
-
- C1990 Pagani Massimiliano
-
-
- 0 DISTRIBUTION RULES
- You can freely copy this program and give a copy to anyone, only if you
- don't charge and if you give all files relative to VIF.
- You are allowed to put VIF and its files on a BBS or in public domain and
- share ware collections (as Fred Fish one).
- It's forbidden modifing the files vif.e.doc, vif.c without my written
- consense.
- Again, the diffusion of this program will have to be free gifting.
- The Author is not responsible of data damages/losses deriving from using
- correctly, or not, the VIF program.
-
- OK I think that's enough, let's go...
-
- 0.1 Files
- Distributions files are:
-
- VIF - the executable (13364 bytes)
- VIF.c - the source code (10819 bytes)
- VIF.doc - italian version of this doc (9801 bytes).
- VIF.e.doc - this English doc (7794 bytes).
-
- If you can't find all these files, you can contact me to get the last
- version (my address is at the end of this file)
-
-
-
- 1 WHAT DOES VIF DO?
- VIF is a filter. It takes an input text file and outputs another text file.
- During this operation VIF removes all useless characters. (We'll se in a
- while what are useless chars).
- This program has come out from the need of archiving, in an organic way, a
- great number of documents. Before I wrote VIF, I had to use a text editor
- to do the same job with a great amount of patience.
- You can run VIF only from CLI. To use VIF you have to know at least
- something of AmigaDOS.
-
-
-
- 2 WHICH CHARACTERS ARE REMOVED BY VIF?
-
- 2.1 Spaces -> tabs
- A tab char allows to gain from 1 to 7 chars. Example:
-
- T-------T-------T-------T-------T-------T-------T-------T-------T
- __some_characters__________________other_characters.
-
- In the first line i've pointed out the tabulations (one every 8
- characters). In the second line an example of text where '_' represents the
- space character.
- After VIF processing the second line became:
-
- T-------T-------T-------T-------T-------T-------T-------T-------T
- __some_characters<T> <T> ___other_characters.
-
- Where <T> shows a tab char. You can see that the spacing between words is
- the same as before, but now you use 13 character less.
-
-
- 2.2 Spaces and tabs before the end of line.
- Invisible characters (spaces and tabs) just before the end of a line are
- useless since you can't see them and they don't contribute to any spacing,
- then they will be removed without fear.
-
-
- 2.3 Newlines before the end of file.
- Like spaces and tabs of the point 2.2 lines at the end of file are of no
- use to anyone.
- VIF is quite intelligent (!) in this cases: if there are some empty lines
- and one of these contains only spaces and tabs, this will be considered
- empty and will be removed.
-
-
- 2.4 Spaces covered by tabs
- Here is an example:
-
- T-------T-------T-------T-------T-------T-------T-------T-------T
- __<T> some characters
-
- The first two spaces are useless since they are "covered" by the tab that
- follows them.
-
-
- 2.5 ^M e ^Z
- Messy Dossy computers use memory hungry conventions about text files - to
- end a line they use two characters, one to return carriage at the beginning
- of line (carriage return) and one to move down to the next line (line
- feed). Amiga (and many other computers) does the same with only one
- character. In few words at the end of the line you can find ^J^M, but only
- ^J is needed.
- Another useless character is ^Z which, again in messy dossy systems, marks
- the end of the file.
-
-
- 2.6 Optionally escape sequences.
- Optionally you can remove escape sequences, i.e. characters sequences which
- begin with ^[ (escape), then [ (or character 0x9B instead of these two),
- followed by other chars.
- These special codes are used to change color, graphic rendering (bold,
- underline, italic), cursor position and for other operations.
- If you print the ascii file with a "type" command you'll see these changes
- correctly, but if you use an editor or a "more"-like command, it's easy
- you'll see garbage.
-
-
-
- 3. USAGE
- As I pointed out before, VIF works ONLY from CLI, this means no friendly
- user interface. May be one day, for a future release...
- There are some ways to invoke VIF. To get some help from VIF itself
- it is sufficent to type:
-
- 1> vif ?
-
-
- 3.1 Options
- In every way you use VIF, you can specify some options as follows:
-
- 1> vif -<letters>
-
- Currently supported options are:
- -e Keep escape sequences
- -q Quiet mode: no writings.
- -p Every 16 lines read, vif print a '#'.
- These options can be combined together simply specifing more than a letter
- after the '-'. [For example to keep escape sequences and to show that
- something is going on, you have to use:
-
- 1> vif -ep
-
- N.B.
- 1> vif -e -p
- Doesn't work (at present, may be one day...)]
-
-
- 3.2 From stdin to stdout.
- This is the first and the simplest way of working of VIF. It takes its
- standard input, and put the filtered result in the standard output.
- This system is usefull when using pipes and redirections.
- To invoke VIF for this case you have to specify:
-
- 1> vif
-
- Eventually followed by some options. Option -q is automatically activated,
- while option -p is disabled.
-
-
- 3.3 From a file to another one
- Syntax is:
-
- vif [-epq] source_file destination_file
-
- destination_file will be created. If there is another file named like
- destination_file is, it will be deleted.
-
-
- 3.4 From a file to itself.
- The result of the filtering is put in a temporary file, at the end of the
- operation, this file is copied onto the original one.
- Syntax is:
-
- vif [-epq] file
-
- Temporary file is named t:viftemp%d. Where %d is for an integer number.
- Of course you need device t: assigned otherwise you will get the request
- to insert volume T in any drive.
- VIF checks if this file exists, if the check result is positive VIF
- increments the number until it finds a non-existant file.
- I think that's important to notice that VIF doesn't work directly on the
- file, indeed you can always recover data if an error should occour.
-
-
- 3.5 Warning
- Pay attention when you invoke VIF on a source code. In fact VIF doesn't
- know anything about language syntax. Say you have the line:
-
- T-------T-------T-------T-------T-------T-------T-------T
-
- printf("hello boy!\n");
-
- VIF will translate the space between `hello' and `boy' with a tab char,
- because `boy' is on a tab boundary. When you compile the source and run the
- executable, you will get:
-
- hello boy
-
- Three space instead of one
-
-
- 4 SOON ON THESE SCREENS
- I have some ideas on VIF evolution. Actually I have other programs to write,
- but if VIF gives me some satisfaction I will go on and implement the
- following options:
- - Paragraphs formatting with or without fill.
- - Accented vowels substitutions: e' -> รจ (useless for english people, sorry).
- - User interface for batch operations.
- - Comments and useless spaces removal from C source code.
- - paging.
-
-
- 5 SOME ENDING NOTES
- To realize VIF I've used all good programming rules learned at school and
- on the work field, indeed I think that there shouldn't be ANY problem. I've
- tested VIF on 6 Mbytes of docs in multitasking (i.e. while doing other
- things on the computer) and I got no problems.
- Always you can recover data integrally (but when you use VIF from stdin to
- stdout).
- Actually VIF is NOT a pure program, it means that you can't load VIF as
- resident and use it from more than one process. If I'll get enough request
- to make VIF pure, I'll search the docs on pure programs and I'll turn it
- pure.
-
- If you use VIF and you think that is a good useful program and you want to
- contribute to software developement ($$), or you have discovered an
- interesting way to get a GURU with VIF, or you have any suggestions, my
- address follows:
-
- Pagani Massimiliano
- via Mazzini 40
- 21052 Busto Arsizio (VA)
- ITALY
-
- For the previous last things you can contact me with e-mail at:
-
- ele0001@cdc835.cdc.polimi.it
-
- [The address is equal to 131.175.6.2]
-
- Thanx and enjoy.
-