home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !MAGS / !BONUS / COVERDSK / STFORMAT / STF62.ZIP / STF62.MSA / TUC102 / TUC.TXT < prev    next >
Text File  |  1994-07-07  |  10KB  |  334 lines

  1. ==========
  2. T:he
  3. U:ltimate          (Well not yet but it could be)
  4. C:onvertor
  5. ==========
  6.  
  7. A shareware program by Kevin Millican.
  8.  
  9. ---------------------------------------------------------------------
  10.  
  11. SHAREWARE:
  12.  
  13. If you find this program useful the you are asked to send the sum of 
  14. £10 to :-
  15.  
  16. Kevin Millican
  17. 20 St Johns Road
  18. Belton
  19. Great Yarmouth
  20. Norfolk
  21. NR31 9NS
  22.  
  23. In return I will send you the latest version, along with the source 
  24. code, and provided it is not too exhaustive I will also add one new 
  25. command to your specification. In this way the utility will grow to 
  26. meet the requirements of most users.
  27.  
  28. Thanks : keep shareware alive!
  29.  
  30. ---------------------------------------------------------------------
  31.  
  32. DISCLAIMER
  33.  
  34. I've tried to ensure that this program is safe to use but I cannot 
  35. ensure that it will never give any problems and it is supplied 
  36. without warranty of any kind. You use this program at your own risk 
  37. and by using the program you imply your acceptance of these 
  38. conditions.
  39.  
  40. ---------------------------------------------------------------------
  41.  
  42. SO WHAT IS IT?
  43.  
  44. Ever looked at a wordprocessed file format or a resource file etc. 
  45. and thought 'hey I could convert that to a format for my 
  46. wordprocessor or carry out a desirable change' ?
  47.  
  48. I did. So I hunted around my PD catalogues and BBS filelists and 
  49. tried out a couple of search/replace programs. Then I had a play with 
  50. Harlekin and Tempus and realised there was a bit more to it than that 
  51. - I needed something that would take a series of commands from a text 
  52. file, carry out search/replace actions on each one and resave the 
  53. file.
  54.  
  55. It needed it to be able to work with all ASCII characters, have a 
  56. simple format, but be powerful enough to cope with typical document 
  57. files.
  58.  
  59. After a bit of investigation I wrote TUC.
  60.  
  61. This is the second version and I have included a number of 'TUC' 
  62. files as examples. Look at SAMPLES.TXT for descriptions.
  63.  
  64. There are also a couple of test documents in these formats (all with 
  65. the extender '.EX'), although be warned; the WordPerfect ones are 
  66. exports from WordStar for Windows, not the genuine article. Only the 
  67. basic commands have been dealt with but it is easy to add others 
  68. depending on what you find.
  69.  
  70. These files demonstrate the use ot the TUC language and are fairly 
  71. useful in their own right.
  72.  
  73. ---------------------------------------------------------------------
  74.  
  75. POSSIBLE APPLICATIONS
  76.  
  77. 1. Conversion of wordprocessing files from one format to another 
  78. (well that was what I originally wrote it for).
  79.  
  80. 2. Modifying Text in program or resource files, e.g. for translation 
  81. purposes.
  82.  
  83. 3. General repetitive search/replace utility.
  84.  
  85. 4. Conversion of printer spool files.
  86.  
  87. 5. Global conversion of printer driver sources.
  88.  
  89. 6. Conversion of dialects of programming languages.
  90.  
  91. 7. Research prior to developing dedicated conversion programs.
  92.  
  93. If you find it useful for something else - please let me know and 
  94. I'll add it to the list.
  95.  
  96. ---------------------------------------------------------------------
  97.  
  98. SIMPLE USE OF TUC.TTP
  99.  
  100. Call the program with a single filename. You will be asked for a 
  101. series of commands and a target filename on completion. If you just 
  102. want to see the results on screen then end the sequence with the 
  103. command 'display' and use the target filename "con:" to avoid 
  104. actually saving anything.
  105.  
  106. A trivial use of the program is to replace a single string in a file 
  107. with another.
  108.  
  109. ---------------------------------------------------------------------
  110.  
  111. TUC FILE USAGE
  112.  
  113. The syntax of the command line to be passed to TUC.TTP is :-
  114.  
  115. sourcename targetname =TUCfilename
  116.  
  117. eg.
  118.  
  119. WRDPER50.EX TEST.RTF =WP50_RTF.TUC
  120.  
  121. ---------------------------------------------------------------------
  122.  
  123. OPERATION/TUC COMMANDS
  124.  
  125. The program will allocate memory for 10 times the size of the 
  126. sourcefile if possible. A minimum of three times the size of the 
  127. sourcefile is necessary for it to run.
  128.  
  129. Each sequence of commands consists of a keyword followed by an 
  130. appropriate number of parameters on consecutive lines.
  131.  
  132. Keywords can be in upper or lower case.
  133.  
  134. =====================================================================
  135. DETAILS :-
  136. ---------------------------------------------------------------------
  137.  
  138. REPLACE
  139. <oldstring>
  140. <newstring>
  141.  
  142. As with all TUC parameters the parameters consist of a combination of 
  143. strings, decimal, and hexadecimal data e.g.
  144.  
  145. 65,66,67
  146. $41,$42,$43
  147. "ABC"
  148. 65,"B",$43
  149.  
  150. are all identical TUC parameters ("ABC")
  151.  
  152. Note that real strings MUST be in double quotes (").
  153.  
  154. ex.
  155.  
  156. replace
  157. 9
  158. "\tab"
  159.  
  160. This routine will search through the sourcefile and convert every TAB 
  161. character (9) with the phrase :- \tab
  162.  
  163. The '?' character is a single wildcard so "A?C" would convert "A C", 
  164. "A=C", "ACC", "AbC" etc.
  165.  
  166. ---------------------------------------------------------------------
  167.  
  168. WILDCARD
  169. <newvalue>
  170.  
  171. If you really need to look for a '?' character, it is a bit 
  172. inconvenient to have the wildcard character the same. This command 
  173. switches the wildcard to a different character - don't forget to 
  174. change it back afterwards!
  175.  
  176. ex.
  177.  
  178. wildcard
  179. "#"
  180.  
  181. wildcard
  182. "?"
  183.  
  184. ---------------------------------------------------------------------
  185.  
  186. TOGGLE
  187. <oldstring>
  188. <newstring1>
  189. <newstring2>
  190.  
  191. This command is like REPLACE but the first time <oldstring> is 
  192. encountered it replaces it with <newstring1> and the second time with 
  193. <newstring2>, third with <newstring1> etc.
  194.  
  195. This is used for files where the same character switches an attribute 
  196. on and off.
  197.  
  198. ---------------------------------------------------------------------
  199.  
  200. RATIONALISE
  201. <string1>
  202. <string2>
  203. <default setting>
  204.  
  205. This command is needed to enable attributes separated by the TOGGLE 
  206. command to be switched back into a toggle string properly. If you 
  207. look at a typical file with different attributes to switch a 
  208. particular feature on or off, you will probably note that it is not 
  209. fussy about say switching it off several times without switching it 
  210. on in between. For example, a rich text format file will use '\b ' to 
  211. switch on BOLD and '\b0 ' to switch it off. However you may find a 
  212. series of '\b0 ' attributes which obviously can't be converted 
  213. directly to another format that say uses <control-B> to toggle bold 
  214. on OR off.
  215.  
  216. This command will check for repeated changes and eliminate any 
  217. irrelevant duplicates. The <default setting> should be set to either 
  218. 1 or 2 depending on whether the default is string1 or string2.
  219.  
  220. ex.
  221.  
  222. To fix an RTF file so that it can be converted to an attribute 
  223. ON/attibute OFF -type wordprocessing file :-
  224.  
  225. RATIONALISE
  226. "\b "
  227. "\b0 "
  228. 2
  229.  
  230. This would change the following string at the beginning of a file :-
  231.  
  232. \b0 Here is some \b bold text\b0 and \b0 \ul underlined\ul0 .
  233.  
  234. to:-
  235.  
  236. Here is some \b bold text\b0 and \ul underlined\ul0 .
  237.  
  238. If the third parameter was 1 instead of 2, the first '\b0 ' would be 
  239. retained.
  240.  
  241. There are numerous uses of this routine in other types of file too; 
  242. eg. to remove duplicated unnecessary sequences in VT52 or ANSI 
  243. scripts.
  244.  
  245. ---------------------------------------------------------------------
  246.  
  247. STRIP
  248. <first character>
  249. <last character>
  250.  
  251. This command will strip out all occurences of characters between and 
  252. including the first and last specified.
  253.  
  254. e.g.
  255.  
  256. STRIP
  257. 0
  258. 31
  259.  
  260. removes all characters less than a space.
  261.  
  262. STRIP
  263. "0"
  264. "9"
  265.  
  266. removes all numbers from the text.
  267.  
  268. etc.
  269.  
  270. ---------------------------------------------------------------------
  271.  
  272. DISPLAY
  273.  
  274. Shows current altered file on screen (only of real use during 
  275. development of TUC routines) - use control-S and control-Q to stop 
  276. and start the screen output.
  277.  
  278. ---------------------------------------------------------------------
  279.  
  280. LOSEUNTIL
  281. <searchstring>
  282.  
  283. Ignores all characters prior to but not including <searchstring> ie. 
  284. removes unwanted preceding stuff.
  285.  
  286. ---------------------------------------------------------------------
  287.  
  288. LOSEFROM
  289. <searchstring>
  290.  
  291. Ignores all characters after <searchstring> ie. removes unwanted 
  292. trailing stuff AND the <searchstring>
  293.  
  294. ---------------------------------------------------------------------
  295.  
  296. SUFFIX
  297. <newstring>
  298.  
  299. Adds <newstring> to the end of the file.
  300.  
  301. ---------------------------------------------------------------------
  302.  
  303. PREFIX
  304. <newstring>
  305.  
  306. Inserts <newstring> at the beginning of the file.
  307.  
  308. ---------------------------------------------------------------------
  309.  
  310. REPORT
  311. <oldstring>
  312.  
  313. Does not carry out any changes, merely reports the number of 
  314. occurences of <oldstring>. Sometimes useful during development.
  315.  
  316. ---------------------------------------------------------------------
  317.  
  318.  
  319.  
  320. If the keyword is unrecognised then it will just be displayed on 
  321. screen so you can add comments easily provided that you don't 
  322. duplicate any keywords on their own or interrupt the parameters.
  323.  
  324. Have a look at the example TUC files to see how these work together.
  325.  
  326. I will be adding several new commands - these are just a taster of 
  327. what is to come. I'm releasing this archive now so that I can get 
  328. some feedback of whether this program is of use to others and worth 
  329. continued development. If you want this to happen then please support 
  330. its development by registering.
  331.  
  332. Kevin Millican
  333.  
  334.