home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / bbs / libdisks / d700t799 / disk792.lha / TClass / Programmer.doc < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.4 KB  |  83 lines

  1.                                 DOCUMENT: PROGRAMMER
  2.  
  3. This is the programmer document for TClass.  Other documents in this
  4. directory:
  5.  
  6. AI.doc
  7. TClass.doc
  8. Installation.doc
  9. showbytes.doc
  10.  
  11.                                   Contents
  12.  
  13.           1.A - What is TClass.brain?
  14.           1.B - How is it structured?
  15.  
  16. ================================================================================
  17.  
  18. 1.A - What is TClass.brain?
  19.  
  20. TClass.brain (located in S:) contains info on how to recognize different
  21. types of files.
  22.  
  23. 1.B - How is it structured?
  24.  
  25. Here's an example TClass.brain file:
  26.  
  27. #TClass.brain
  28. # lines beginning with # are comments, and blank lines are ignored
  29.  
  30. C source::%ext(c)::
  31. Document::%ext(doc)::
  32. German document::%ext(dok)::
  33. Uuencoded file::%match(0,begin * *)
  34. Executable::0,0,3,-13,0,0,0,0,0,0,0,i,0,0,0,0,0,0,0::
  35. Font::15,0,0::
  36.  
  37. This is a short example, of course.  Here's the basic synopsis for each
  38. entry:
  39.  
  40. <filetype name>::<bytelist>::
  41.   or
  42. <filetype name>::%<function(<args>)>::
  43.  
  44. So for the font entry:
  45.  
  46. Font::15,0,0::
  47.  
  48. If a file's 1st byte is 15, 2nd is 0, and 3rd is 0, then it's a font.  The
  49. rest of the 17 bytes are ignored, since they vary.
  50.  
  51. Also note that instead of numbers, you can have characters.  For instance,
  52. DMS archives begin with the string "DMS!".  So you could do this:
  53.  
  54. DMS archive::'D','M','S','!'::
  55.  
  56. Now, sometimes, you may not be able to make TClass learn files.  Files like C
  57. code and text files obviously can't be learned.  So you can make use of
  58. functions to recognize these.  All function arguments are case insensitive.
  59. AND, when a function takes two or more parameters, you MUST NOT put spaces
  60. after or before commas!!  Ex:
  61. %foobar(hi, 2)  is INVALID
  62. %blech(2,start,8) is valid.
  63. As of now, there are these functions:
  64.  
  65. %ext(extension)
  66. Where extension is the file extension.  Examples:
  67. C source::%ext(c)::
  68. LHA AutoDisplay file::%ext(displayme)
  69.  
  70. %match(pos,pattern)
  71. Matches for "pattern" beginning at "pos."  Let's say you had some file type
  72. that always had the word "BEGIN" starting at the 3rd byte:
  73. µ¤BEGIN.........
  74. Since the first two bytes always change, it would be good to do this:
  75. weird file::%match(2,BEGIN*)
  76. Note, this starts at position 2.  ALWAYS with these functions, byte counting
  77. starts at 0, then 1, 2, 3, etc.  Also, the pattern match method is UNIX.  ?
  78. is not used, only * is recognized.  (* is the same as #? in AmigaDOS)
  79.  
  80. These function descriptions could be vague.  If so, feel free to contact me
  81. at shulick@indiana.edu and I'll help.
  82.  
  83.