home *** CD-ROM | disk | FTP | other *** search
- DOCUMENT: PROGRAMMER
-
- This is the programmer document for TClass. Other documents in this
- directory:
-
- AI.doc
- TClass.doc
- Installation.doc
- showbytes.doc
-
- Contents
-
- 1.A - What is TClass.brain?
- 1.B - How is it structured?
-
- ================================================================================
-
- 1.A - What is TClass.brain?
-
- TClass.brain (located in S:) contains info on how to recognize different
- types of files.
-
- 1.B - How is it structured?
-
- Here's an example TClass.brain file:
-
- #TClass.brain
- # lines beginning with # are comments, and blank lines are ignored
-
- C source::%ext(c)::
- Document::%ext(doc)::
- German document::%ext(dok)::
- Uuencoded file::%match(0,begin * *)
- Executable::0,0,3,-13,0,0,0,0,0,0,0,i,0,0,0,0,0,0,0::
- Font::15,0,0::
-
- This is a short example, of course. Here's the basic synopsis for each
- entry:
-
- <filetype name>::<bytelist>::
- or
- <filetype name>::%<function(<args>)>::
-
- So for the font entry:
-
- Font::15,0,0::
-
- If a file's 1st byte is 15, 2nd is 0, and 3rd is 0, then it's a font. The
- rest of the 17 bytes are ignored, since they vary.
-
- Also note that instead of numbers, you can have characters. For instance,
- DMS archives begin with the string "DMS!". So you could do this:
-
- DMS archive::'D','M','S','!'::
-
- Now, sometimes, you may not be able to make TClass learn files. Files like C
- code and text files obviously can't be learned. So you can make use of
- functions to recognize these. All function arguments are case insensitive.
- AND, when a function takes two or more parameters, you MUST NOT put spaces
- after or before commas!! Ex:
- %foobar(hi, 2) is INVALID
- %blech(2,start,8) is valid.
- As of now, there are these functions:
-
- %ext(extension)
- Where extension is the file extension. Examples:
- C source::%ext(c)::
- LHA AutoDisplay file::%ext(displayme)
-
- %match(pos,pattern)
- Matches for "pattern" beginning at "pos." Let's say you had some file type
- that always had the word "BEGIN" starting at the 3rd byte:
- µ¤BEGIN.........
- Since the first two bytes always change, it would be good to do this:
- weird file::%match(2,BEGIN*)
- Note, this starts at position 2. ALWAYS with these functions, byte counting
- starts at 0, then 1, 2, 3, etc. Also, the pattern match method is UNIX. ?
- is not used, only * is recognized. (* is the same as #? in AmigaDOS)
-
- These function descriptions could be vague. If so, feel free to contact me
- at shulick@indiana.edu and I'll help.
-
-