DIRECTORY IO, DBCommon, DBSegment, DBStats, DBStorageGroup, DBStorageGroupScan, DBStoragePage, DBStoragePrint, DBStorageTuple; DBStoragePrintImpl: CEDAR PROGRAM IMPORTS DBCommon, DBSegment, DBStats, DBStorageGroup, DBStorageGroupScan, DBStoragePage, IO EXPORTS DBStoragePrint = BEGIN OPEN IO, DBCommon; Assert: PROC[condition: BOOLEAN] = {IF ~condition THEN ERROR}; Print: PROC [] = { DBSegment.CheckState[doPrinting: TRUE, printOnlyLockedPages: FALSE]; DBStorageGroupScan.CheckState[doPrinting: TRUE]; DBStats.Print[heading: "DBStorageDebugImpl.Print", out: DBCommon.GetDebugStream[]]; }; PrintPage: PUBLIC PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { SELECT DBStoragePage.TagOfPage[LOOPHOLE[p]] FROM DBStoragePage.Unused, DBStoragePage.Free, DBStoragePage.AMap, DBStoragePage.BTree => PrintPageType[dbPage, p, fullPrint]; DBStoragePage.Tuple, DBStoragePage.SystemTuple => PrintVecPage[dbPage, LOOPHOLE[p], fullPrint]; DBStoragePage.OverflowTuple => PrintOverflowPage[dbPage, LOOPHOLE[p], fullPrint]; ENDCASE => PrintPageUnknown[dbPage, p, fullPrint]; DBCommon.GetDebugStream[].PutF["*n"]; };--PrintPage PrintPageType: PROC[dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { DBCommon.GetDebugStream[].PutF["%bB: a %g", card[dbPage], IO.rope[PagetagToRope[DBStoragePage.TagOfPage[LOOPHOLE[p]]]]]; };--PrintPageType PrintPageUnknown: PROC[dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { DBCommon.GetDebugStream[].PutF["%bB: a page of type %g, an unrecognized type", card[dbPage], card[DBStoragePage.TagOfPage[LOOPHOLE[p]]]]; };--PrintPageUnknown PrintVecPage: PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = TRUSTED { debugS: IO.STREAM_ DBCommon.GetDebugStream[]; debugS.PutF["%bB: a %g with %g words in free vec space", card[dbPage], IO.rope[PagetagToRope[DBStoragePage.TagOfPage[p]]], card[DBStoragePage.WordsLeftOnPage[p]]]; IF ~fullPrint THEN RETURN; debugS.PutF["*n"]; FOR slotIndex: CARDINAL IN [1 .. DBStoragePage.HighSlotIndexOfPage[p]] DO debugS.PutF["%g: ", card[slotIndex]]; SELECT DBStoragePage.TypeOfSlot[p, slotIndex] FROM DBStoragePage.FreeType => PrintFreeSlot[]; DBStoragePage.UnFreeType => PrintUnFreeSlot[]; DBStoragePage.TSDictType => PrintTSDict[p, slotIndex]; DBStoragePage.LStringType => PrintLString[p, slotIndex]; IN [1..DBStoragePage.MaxTuplesetPerPage] => PrintTupleVec[p, slotIndex]; ENDCASE => PrintUnimplemented[DBStoragePage.TypeOfSlot[p, slotIndex]]; ENDLOOP; };--PrintVecPage PrintOverflowPage: PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = TRUSTED { debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["%bB: a string overflow page with %g words in free vec space", card[dbPage], card[DBStoragePage.WordsLeftOnPage[p]]]; IF ~fullPrint THEN RETURN; debugStream.PutF["*n"]; FOR slotIndex: CARDINAL IN [1 .. DBStoragePage.HighSlotIndexOfPage[p]] DO debugStream.PutF["%g: ", card[slotIndex]]; SELECT DBStoragePage.TypeOfSlot[p, slotIndex] FROM DBStoragePage.EStringType => PrintEString[p, slotIndex]; ENDCASE => PrintUnimplemented[DBStoragePage.TypeOfSlot[p, slotIndex]]; ENDLOOP; };--PrintOverflowPage PrintEString: PROC[ p: LONG POINTER TO DBStoragePage.VecPage, slotIndex: CARDINAL] = TRUSTED { eString: LONG POINTER TO DBStoragePage.EString _ LOOPHOLE[DBStoragePage.VecOfSlot[p, slotIndex]]; eStringID: TID _ eString.eStringID; nWordsForText: CARDINAL _ eString.header.length - DBStoragePage.SizeOfNullEString; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["External string descriptor, eStringID: %bB, nBytes: %g*n", card[eStringID], card[2*nWordsForText]]; debugStream.PutF[" text: """]; FOR i: CARDINAL IN [0..nWordsForText*2) DO debugStream.PutF["%g", char[eString.text[i]]]; ENDLOOP; debugStream.PutF["""*n"]; };--PrintEString PrintLString: PROC[ p: LONG POINTER TO DBStoragePage.VecPage, slotIndex: CARDINAL] = TRUSTED { lString: LONG POINTER TO DBStoragePage.LString _ LOOPHOLE[DBStoragePage.VecOfSlot[p, slotIndex]]; eStringID: TID _ lString.eStringID; DBCommon.GetDebugStream[].PutF["Local string descriptor, bytesInRemString: %g, eStringID: %bB*n", card[lString.bytesInRemString], card[eStringID]]; };--PrintLString PrintTSDict: PROC[ p: LONG POINTER TO DBStoragePage.VecPage, slotIndex: CARDINAL] = TRUSTED { pDict: LONG POINTER TO DBStoragePage.TSDict _ LOOPHOLE[DBStoragePage.VecOfSlot[p, slotIndex]]; nEntries: CARDINAL _ DBStoragePage.NEntries[pDict]; entry: CARDINAL; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; Assert[slotIndex = DBStoragePage.TSDictSlotIndex]; debugStream.PutF["Tupleset dictionary containing %g entry(s):*n", card[nEntries]]; FOR entry IN [1..nEntries] DO debugStream.PutF[" %g:", card[entry]]; debugStream.PutF[" TuplesetID: %bB,", card[pDict.seq[entry].tuplesetID]]; debugStream.PutF[" NextPage: %bB,", card[pDict.seq[entry].next]]; debugStream.PutF[" PrevPage: %bB*n", card[pDict.seq[entry].prev]]; ENDLOOP; };--PrintTSDict PrintTupleVec: PROC[ p: LONG POINTER TO DBStoragePage.VecPage, slotIndex: CARDINAL] = TRUSTED { pTuple: LONG POINTER TO DBStoragePage.TupleBody _ LOOPHOLE[DBStoragePage.VecOfSlot[p, slotIndex]]; nDataWords: CARDINAL _ pTuple.groupOffset - DBStoragePage.SizeOfNullTuple; groupList: LONG DESCRIPTOR FOR DBStorageGroup.GroupList _ DBStorageGroup.GroupListFromTupleBase[pTuple]; dataword, entry: CARDINAL; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["Tuplevec of local type %g containing %g words fixed data, %g group list entry(s)*n", card[DBStoragePage.TypeOfSlot[p, slotIndex]], card[nDataWords], card[LENGTH[groupList]]]; debugStream.PutF[" data:"]; FOR dataword IN [0..nDataWords) DO debugStream.PutF["%b,", card[pTuple.fields[dataword]]]; ENDLOOP; debugStream.PutF["*n"]; FOR entry IN [0..LENGTH[groupList]) DO debugStream.PutF[" %g:", card[entry]]; debugStream.PutF[" GroupID: %bB,", card[groupList[entry].groupID]]; debugStream.PutF[" FirstTuple: %bB,", card[groupList[entry].firstTID]]; debugStream.PutF[" LastTuple: %bB*n", card[groupList[entry].lastTID]]; ENDLOOP; };--PrintTupleVec PrintFreeSlot: PROC = { DBCommon.GetDebugStream[].PutF["Free slot*n"]; };--PrintFreeSlot PrintUnFreeSlot: PROC = { DBCommon.GetDebugStream[].PutF["UnFree slot (this is an debugStream)*n"]; };--PrintUnFreeSlot PrintUnimplemented: PROC[slotType: CARDINAL] = { DBCommon.GetDebugStream[].PutF["Slot type is %g, what does THAT mean?*n", card[slotType]]; };--PrintUnimplemented PagetagToRope: PROC [tag: CARDINAL] RETURNS [ROPE] = { RETURN [SELECT tag FROM DBStoragePage.Unused => "unused page", DBStoragePage.Free => "free page", DBStoragePage.AMap => "AMap page", DBStoragePage.Tuple => "user tuple page", DBStoragePage.SystemTuple => "system tuple page", DBStoragePage.BTree => "BTree page", ENDCASE => ERROR]; };--PagetagToString END.--StoragePrintImpl CHANGE LOG Created by MBrown on May 27, 1980 11:04 AM Changed by MBrown on May 28, 1980 9:59 AM Changed by MBrown on June 1, 1980 12:33 PM Changed by MBrown on June 18, 1980 8:19 PM Changed by MBrown on August 2, 1980 10:37 PM Changed by MBrown on August 23, 1980 10:39 AM Changed by MBrown on August 23, 1980 12:18 PM Changed by Cattell on 30-Dec-81 10:35:01 Changed by Willie-Sue on June 24, 1982 12:07 pm Changed by Willie-Sue on June 30, 1982 4:31 pm Changed by Willie-Sue on February 15, 1985 °File: DBStoragePrintImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by: MBrown on February 27, 1981 3:41 PM Cattell on June 16, 1983 3:31 pm Willie-Sue on February 15, 1985 11:29:18 am PST Widom, September 3, 1985 5:10:59 pm PDT Donahue, May 23, 1986 9:58:27 am PDT Maximum printing with minimum keystrokes Still working on it... Changed for new definition of GroupListOfTuple. Changed for rearrangements in storage level. Changed for change of interface: this module now is to print any type of page, not just vec pages. Right now it does no more than print a string name for the page tag if the page has some other type (e.g. AMap, BTree). Types that used to be in DBStoragePrivateB have now moved to separate defs. Added printing of LStrings and EStrings. Changed PF format codes to IOStream format codes. IOStream => IO debugStream => DBCommon.GetDebugStream[] made Cedar, added tioga formatting Κ˜šœ™Jšœ Οmœ1™<—Jšœ™Jšœ$™$Jšœ ™ Jšœ/™/™'Icode™$—J˜J˜šΟk ˜ Jšžœ˜J˜ J˜ J˜J˜J˜J˜J˜J˜J˜—šœžœž˜!šž˜J˜ J˜ J˜J˜J˜Jšœ˜Jšž˜—Jšžœ˜J˜—Jšžœžœžœ ˜˜Jš Οnœžœ žœžœ žœžœ˜>J˜šŸœžœ˜Jšœ(™(Jšœ!žœžœ˜DJšœ*žœ˜0J˜SJ˜J˜—šŸ œžœžœ˜Jšœžœžœ žœ˜Ašžœžœž˜0J˜J˜J˜J˜;J˜Jšœ2žœ˜JJšœ9žœ˜Q—Jšžœ+˜2J˜%JšœΟc ˜ —J˜š Ÿ œžœžœžœ žœ˜UJšœ:žœ,žœ˜xJšœ ˜—J˜š Ÿœžœžœžœ žœ˜X˜\Jšœžœ˜,—Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœ žœžœ˜IJ˜Jšœžœžœ˜-˜FJšžœZ˜\—Jšžœ žœžœ˜J˜šžœ žœžœ-ž˜IJ˜%šžœ(ž˜2J˜*J˜.J˜6J˜8JšžœF˜H—Jšžœ?˜F—Jšžœ˜Jšœ ˜—J˜šŸœžœ˜Jš œžœžœ žœžœ˜IJ˜Jšœ žœžœ˜2˜OJ˜6—Jšžœ žœžœ˜J˜šžœ žœžœ-ž˜IJ˜*šžœ(ž˜2J˜8—Jšžœ?˜F—Jšžœ˜Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ#žœžœ˜JJ˜šœ žœžœžœ˜0Jšžœ(˜0—Jšœ žœ˜#Jšœžœ;˜RJšœ žœžœ˜2˜LJ˜(—J˜"šžœžœžœž˜*J˜.Jšžœ˜—J˜Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ#žœžœ˜JJ˜šœ žœžœžœ˜0Jšžœ(˜0—Jšœ žœ˜#˜aJ˜1—Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ#žœžœ˜KJ˜šœžœžœžœ˜-Jšžœ(˜0—Jšœ žœ!˜3Jšœžœ˜Jšœ žœžœ˜2Jšœ2˜2J˜Ršžœžœž˜J˜'J˜KJ˜AJ˜B—Jšžœ˜Jšœ  ˜—J˜šŸ œžœ˜Jš œžœžœžœ#žœžœ˜JJ˜šœžœžœžœ˜1Jšžœ(˜0—Jšœ žœ6˜Jšœ žœž œžœ˜9J˜.—Jšœžœ˜Jšœ žœžœ˜2˜fJšœEžœ˜Y—J˜Jšžœ žœžœ9žœ˜cJ˜šžœžœžœ ž˜&J˜'J˜EJ˜GJ˜F—Jšžœ˜Jšœ ˜—J˜šŸ œžœ˜J˜.Jšœ ˜—J˜šŸœžœ˜J˜IJšœ ˜—J˜šŸœžœ žœ˜0J˜ZJšœ ˜—J˜š Ÿ œžœžœžœžœ˜6šžœžœž˜J˜&J˜"J˜"J˜)J˜1J˜$Jšžœžœ˜—Jšœ ˜—J˜J˜J˜—Jšžœ ˜J˜J˜Jšžœž˜ J˜Jšœ)ž˜+J˜Jšœ(ž˜*Jšœ™J˜Jšœ)ž˜+Jšœ/™/J˜Jšœ)ž˜+Jšœ,™,J˜Jšœ+ž˜-Jšœ[™[Jšœ[™[Jšœ#™#J˜Jšœ,ž˜.JšœK™KJ˜Jšœ,ž˜.Jšœ(™(J˜J˜(Jšœ1™1J˜J˜/Jšœ™J˜J˜.Jšœ(™(J™J˜*J™"—…—Θ'χ