ResetSchema:
PUBLIC
PROC[] = {
OpenTransaction[];
IF NOT DB.Null[Note] THEN RETURN;
Note ← DB.DeclareDomain["Note", $Whiteboard];
Icon ← DB.DeclareDomain["WBIcon", $Whiteboard];
WBItem ← DB.DeclareDomain["WBItems", $Whiteboard];
DB.DeclareSubType[of: WBItem, is: Note];
DB.DeclareSubType[of: WBItem, is: Icon];
WBEntity ← DB.DeclareDomain["Whiteboard", $Whiteboard];
contents ← DB.DeclareProperty["contents", Note, DB.RopeType, $Whiteboard];
format ← DB.DeclareProperty["format", Note, DB.RopeType, $Whiteboard];
iconName ← DB.DeclareProperty["entity", Icon, DB.RopeType, $Whiteboard];
iconLabel ← DB.DeclareProperty["label", Icon, DB.RopeType, $Whiteboard];
iconType ← DB.DeclareProperty["type", Icon, DB.RopeType, $Whiteboard];
iconIcon ← DB.DeclareProperty["icon", Icon, DB.RopeType, $Whiteboard];
iconArgument ← DB.DeclareProperty["argument", Icon, DB.RopeType, $Whiteboard];
for whiteboards
versionProp ← DB.DeclareProperty["version", WBEntity, DB.IntType, $Whiteboard];
gridProp ← DB.DeclareProperty["gridSize", WBEntity, DB.IntType, $Whiteboard];
createDateProp ← DB.DeclareProperty["createDate", WBEntity, DB.TimeType, $Whiteboard];
container ← DB.DeclareRelation["container", $Whiteboard];
containerIs ← DB.DeclareAttribute[container, "is", WBEntity];
containerOf ← DB.DeclareAttribute[container, "of", WBItem];
containerX ← DB.DeclareAttribute[container, "x", DB.IntType];
containerY ← DB.DeclareAttribute[container, "y", DB.IntType];
containerW ← DB.DeclareAttribute[container, "w", DB.IntType];
containerH ← DB.DeclareAttribute[container, "h", DB.IntType];
[] ← DB.DeclareIndex[container, LIST[containerIs]];
volumeGroupID ← AlpTransaction.GetNextVolumeGroup[handle: NARROW[whiteboardTrans]] };
SetUpSegment:
PROC [] ~ {
segmentNumber: NAT = 310B;
readOnly ← FALSE;
DB.Initialize[nCachePages: 256];
try opening the segment for writing
DB.DeclareSegment[WBSegment, wbType, segmentNumber, FALSE];
OpenTransaction[ !
DB.Error =>
TRUSTED {
IF code = ProtectionViolation
THEN
{ readOnly ← TRUE; CONTINUE } ELSE GOTO AlreadyDone } ];
IF readOnly
THEN {
attempt to open for writing failed; open it for reading only
CloseTransaction[];
DB.DeclareSegment[WBSegment, wbType, segmentNumber, TRUE, FALSE] }
ELSE CloseTransaction[] -- throw away this worthless transaction
EXITS
AlreadyDone => CloseTransaction[! DB.Error, DB.Failure => CONTINUE]
};