TiogaFileFormat: CEDAR DEFINITIONS = BEGIN Op: TYPE ~ MACHINE DEPENDENT { endOfFile(endOfFileCode), startNode(startNodeCode), startNodeFirst(startNodeFirstCode), startNodeLast(startNodeLastCode), startLeaf(startLeafCode), startLeafFirst(startLeafFirstCode), startLeafLast(startLeafLastCode), prop(propCode), propShort(propShortCode), endNode(endNodeCode), dataRope(dataRopeCode), commentRope(commentRopeCode), runs(runsCode), looks(looksCode), looksFirst(looksFirstCode), looksLast(looksLastCode), look1(look1Code), look2(look2Code), look3(look3Code), (BYTE.LAST) }; numFormats: CARDINAL = 70; numProps: CARDINAL = 50; numLooks: CARDINAL = 50; endOfFileCode: BYTE ~ 0; startNodeCode: BYTE ~ endOfFileCode+1; startNodeFirstCode: BYTE ~ startNodeCode+1; startNodeLastCode: BYTE ~ startNodeFirstCode+numFormats; startLeafCode: BYTE ~ startNodeLastCode+1; startLeafFirstCode: BYTE ~ startLeafCode+1; startLeafLastCode: BYTE ~ startLeafFirstCode+numFormats; otherNodeCode: BYTE ~ startLeafLastCode+1; -- unused otherNodeShortCode: BYTE ~ otherNodeCode+1; otherNodeSpecsCode: BYTE ~ otherNodeShortCode+1; otherNodeSpecsShortCode: BYTE ~ otherNodeSpecsCode+1; propCode: BYTE ~ otherNodeSpecsShortCode+1; propShortCode: BYTE ~ propCode+1; endNodeCode: BYTE ~ propShortCode+1; dataRopeCode: BYTE ~ endNodeCode+1; commentRopeCode: BYTE ~ dataRopeCode+1; runsCode: BYTE ~ commentRopeCode+1; looksCode: BYTE ~ runsCode+1; looksFirstCode: BYTE ~ looksCode+1; looksLastCode: BYTE ~ looksFirstCode+numLooks; look1Code: BYTE ~ looksLastCode+1; look2Code: BYTE ~ look1Code+1; look3Code: BYTE ~ look2Code+1; END. Tioga file format is as follows: == == characters from (non-comment) nodes in display order with a CR after each node == == == byte length of == characters from comment nodes in display order with a CR after each node == == == == [..bytes..] as defined above Thus start with double 0's which can serve to mark end of . == byte length of == == gives length of == == [..bytes..] as defined above == byte address in file for start of comments == sequence of control bytes and control text. The last thing in the file is the . Thus to read a file, first check the and read the byte address for the . We also read the saved as a double check. The saved is a 4 byte checksum of the data part of the file. This lets us read the where we double check to make sure we have a valid file by reading the and the . Then we go to the , checking the and reading the . Finally, we check that ++ = . The , , and are written node by node starting at the root. For each node the following steps are taken: 1. Output a start node control byte of the appropriate sort. either startNode, startLeaf, otherNode, otherNodeShort, or something in the startNodeFirst..startNodeLast range or in the startLeafFirst..startLeafLast range. 2. Output the properties, if any, of the node. if the value is a rope, output ropeProp or ropePropShort else if the value is a node, output nodeProp or nodePropShort. then output the value itself text for props is put in rather than 3. Output the contents of the node. for a text node, first write the runs info, if any, and then the rope. if it is a comment node, then the text goes in comments, else it goes in data. for other varieties of node, write otherNodeSpecs or otherNodeSpecsShort followed by the text of the specifications. 4. Output the children of the node, if any, in the same manner 5. Output an endNode byte, unless this is a terminal text node Following the end of the root node, there is an endOfFile byte. V TiogaFileFormat.mesa Copyright Σ 1985, 1986, 1988, 1991 by Xerox Corporation. All rights reserved. written by Bill Paxton December 1980 Michael Plass, March 14, 1985 11:56:00 am PST Doug Wyatt, October 15, 1991 3:33 pm PDT followed by these specify formatIndex = (op-startNodeFirst) like startNode, but for a node with no children followed by these specify formatIndex = (op-startLeafFirst) followed by followed by end current node and go back up to parent followed by text comes from data part: len chars plus a newline char followed by text comes from comment part: len chars plus a newline char followed by , then that many runs followed by these specify looksIndex = (op-looksFirstCode) followed by followed by followed by followed by max number of entries in the format table for the file others must be given in long form max number of entries in the prop table max number of entries in the look table lengths are given in as few bytes as possible according to following scheme high order bit of each byte tells whether other bytes follow (up to 4 bytes max) concat other 7 bits of bytes with leading 0's to form length thus can represent lengths up to 2**28-1 if use 4 bytes lengths of 127 or less fit in 1 byte lengths in [128..4095] fit in 2 bytes See TiogaFileIO for further information. Κψ•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ ΟeœC™NKšœ$™$K™-K™(—K˜KšΟnœΟkœŸ œŸ˜*K˜šœŸœŸœŸ œ˜Kšœ˜šœ˜Kšœ™—K˜#˜!K™/—˜K™/Kšœ™—K˜#˜!K™/—˜Kšœ.™.—˜Kšœ/™/—˜Kšœ)™)—˜Kšœ™K™8—˜Kšœ™K™;—˜Kšœ/™/—˜Kšœ(™(—K˜˜K™.Kšœ™—˜Kšœ'™'—˜Kšœ5™5—˜KšœC™C—KšœŸœŸœ˜ K˜—K˜K˜šœ Ÿœ˜Kšœ6™6Kšœ!™!—K˜šœ Ÿœ˜Kšœ'™'K™—šœ Ÿœ˜Kšœ'™'—K˜K˜KšœŸœ˜KšœŸœ˜&KšœŸœ˜+KšœŸœ!˜8KšœŸœ˜*KšœŸœ˜+KšœŸœ!˜8KšœŸœΟc ˜4KšœŸœ˜+KšœŸœ˜0KšœŸœ˜5Kšœ Ÿœ˜+KšœŸœ˜!Kšœ Ÿœ˜$KšœŸœ˜$KšœŸœ˜(Kšœ Ÿœ˜#Kšœ Ÿœ˜KšœŸœ˜#KšœŸœ˜.Kšœ Ÿœ˜"Kšœ Ÿœ˜šœ Ÿœ˜K˜K˜—šœK™KKšœP™Pšœ<™K˜K˜6K˜˜FK˜LK˜—K˜,K˜˜4K˜/K˜—K˜3K˜K˜>K˜K˜2K˜K˜>K˜K˜=˜K˜P—K˜MK˜7K˜IK˜MK˜MK˜N˜-K˜AK˜K˜T—K˜,˜˜<˜:˜7K˜+K˜———˜.˜8K˜>—K˜K˜5K˜—˜#˜FK˜8K˜—˜HK˜+K˜——K˜>K˜K˜>K˜K˜?———…—vΔ