========== T:he U:ltimate (Well not yet but it could be) C:onvertor ========== A shareware program by Kevin Millican. --------------------------------------------------------------------- SHAREWARE: If you find this program useful the you are asked to send the sum of œ10 to :- Kevin Millican 20 St Johns Road Belton Great Yarmouth Norfolk NR31 9NS In return I will send you the latest version, along with the source code, and provided it is not too exhaustive I will also add one new command to your specification. In this way the utility will grow to meet the requirements of most users. Thanks : keep shareware alive! --------------------------------------------------------------------- DISCLAIMER I've tried to ensure that this program is safe to use but I cannot ensure that it will never give any problems and it is supplied without warranty of any kind. You use this program at your own risk and by using the program you imply your acceptance of these conditions. --------------------------------------------------------------------- SO WHAT IS IT? Ever looked at a wordprocessed file format or a resource file etc. and thought 'hey I could convert that to a format for my wordprocessor or carry out a desirable change' ? I did. So I hunted around my PD catalogues and BBS filelists and tried out a couple of search/replace programs. Then I had a play with Harlekin and Tempus and realised there was a bit more to it than that - I needed something that would take a series of commands from a text file, carry out search/replace actions on each one and resave the file. It needed it to be able to work with all ASCII characters, have a simple format, but be powerful enough to cope with typical document files. After a bit of investigation I wrote TUC. This is the second version and I have included a number of 'TUC' files as examples. Look at SAMPLES.TXT for descriptions. There are also a couple of test documents in these formats (all with the extender '.EX'), although be warned; the WordPerfect ones are exports from WordStar for Windows, not the genuine article. Only the basic commands have been dealt with but it is easy to add others depending on what you find. These files demonstrate the use ot the TUC language and are fairly useful in their own right. --------------------------------------------------------------------- POSSIBLE APPLICATIONS 1. Conversion of wordprocessing files from one format to another (well that was what I originally wrote it for). 2. Modifying Text in program or resource files, e.g. for translation purposes. 3. General repetitive search/replace utility. 4. Conversion of printer spool files. 5. Global conversion of printer driver sources. 6. Conversion of dialects of programming languages. 7. Research prior to developing dedicated conversion programs. If you find it useful for something else - please let me know and I'll add it to the list. --------------------------------------------------------------------- SIMPLE USE OF TUC.TTP Call the program with a single filename. You will be asked for a series of commands and a target filename on completion. If you just want to see the results on screen then end the sequence with the command 'display' and use the target filename "con:" to avoid actually saving anything. A trivial use of the program is to replace a single string in a file with another. --------------------------------------------------------------------- TUC FILE USAGE The syntax of the command line to be passed to TUC.TTP is :- sourcename targetname =TUCfilename eg. WRDPER50.EX TEST.RTF =WP50_RTF.TUC --------------------------------------------------------------------- OPERATION/TUC COMMANDS The program will allocate memory for 10 times the size of the sourcefile if possible. A minimum of three times the size of the sourcefile is necessary for it to run. Each sequence of commands consists of a keyword followed by an appropriate number of parameters on consecutive lines. Keywords can be in upper or lower case. ===================================================================== DETAILS :- --------------------------------------------------------------------- REPLACE As with all TUC parameters the parameters consist of a combination of strings, decimal, and hexadecimal data e.g. 65,66,67 $41,$42,$43 "ABC" 65,"B",$43 are all identical TUC parameters ("ABC") Note that real strings MUST be in double quotes ("). ex. replace 9 "\tab" This routine will search through the sourcefile and convert every TAB character (9) with the phrase :- \tab The '?' character is a single wildcard so "A?C" would convert "A C", "A=C", "ACC", "AbC" etc. --------------------------------------------------------------------- WILDCARD If you really need to look for a '?' character, it is a bit inconvenient to have the wildcard character the same. This command switches the wildcard to a different character - don't forget to change it back afterwards! ex. wildcard "#" wildcard "?" --------------------------------------------------------------------- TOGGLE This command is like REPLACE but the first time is encountered it replaces it with and the second time with , third with etc. This is used for files where the same character switches an attribute on and off. --------------------------------------------------------------------- RATIONALISE This command is needed to enable attributes separated by the TOGGLE command to be switched back into a toggle string properly. If you look at a typical file with different attributes to switch a particular feature on or off, you will probably note that it is not fussy about say switching it off several times without switching it on in between. For example, a rich text format file will use '\b ' to switch on BOLD and '\b0 ' to switch it off. However you may find a series of '\b0 ' attributes which obviously can't be converted directly to another format that say uses to toggle bold on OR off. This command will check for repeated changes and eliminate any irrelevant duplicates. The should be set to either 1 or 2 depending on whether the default is string1 or string2. ex. To fix an RTF file so that it can be converted to an attribute ON/attibute OFF -type wordprocessing file :- RATIONALISE "\b " "\b0 " 2 This would change the following string at the beginning of a file :- \b0 Here is some \b bold text\b0 and \b0 \ul underlined\ul0 . to:- Here is some \b bold text\b0 and \ul underlined\ul0 . If the third parameter was 1 instead of 2, the first '\b0 ' would be retained. There are numerous uses of this routine in other types of file too; eg. to remove duplicated unnecessary sequences in VT52 or ANSI scripts. --------------------------------------------------------------------- STRIP This command will strip out all occurences of characters between and including the first and last specified. e.g. STRIP 0 31 removes all characters less than a space. STRIP "0" "9" removes all numbers from the text. etc. --------------------------------------------------------------------- DISPLAY Shows current altered file on screen (only of real use during development of TUC routines) - use control-S and control-Q to stop and start the screen output. --------------------------------------------------------------------- LOSEUNTIL Ignores all characters prior to but not including ie. removes unwanted preceding stuff. --------------------------------------------------------------------- LOSEFROM Ignores all characters after ie. removes unwanted trailing stuff AND the --------------------------------------------------------------------- SUFFIX Adds to the end of the file. --------------------------------------------------------------------- PREFIX Inserts at the beginning of the file. --------------------------------------------------------------------- REPORT Does not carry out any changes, merely reports the number of occurences of . Sometimes useful during development. --------------------------------------------------------------------- If the keyword is unrecognised then it will just be displayed on screen so you can add comments easily provided that you don't duplicate any keywords on their own or interrupt the parameters. Have a look at the example TUC files to see how these work together. I will be adding several new commands - these are just a taster of what is to come. I'm releasing this archive now so that I can get some feedback of whether this program is of use to others and worth continued development. If you want this to happen then please support its development by registering. Kevin Millican