LoganBerryExtrasImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Doug Terry, January 28, 1987 3:44:12 pm PST
This should really be part of LoganBerryImpl.mesa. It'll get folded in at a convenient time, perhaps in the conversion to Cedar 7.0.
DIRECTORY
LoganBerry USING [Describe, SchemaInfo],
LoganBerryExtras;
LoganBerryExtrasImpl: CEDAR PROGRAM
IMPORTS LoganBerry
EXPORTS LoganBerryExtras
~ BEGIN
OPEN LoganBerryExtras;
Describe2: PUBLIC PROC [conv: Conv ← NIL, db: OpenDB] RETURNS [info: SchemaInfo] ~ {
Returns schema information about the database.
oldinfo: LoganBerry.SchemaInfo ← LoganBerry.Describe[conv, db];
info ← NEW[SchemaInfoRec];
info.dbName ← oldinfo.dbName;
WHILE oldinfo.logs#NIL DO
log: LogInfo ← NEW[LogInfoRec ← [id: oldinfo.logs.first, file: oldinfo.logNames.first]];
info.logs ← CONS[log, info.logs];
oldinfo.logs ← oldinfo.logs.rest;
oldinfo.logNames ← oldinfo.logNames.rest;
ENDLOOP;
info.logs ← ReverseLogList[info.logs];
WHILE oldinfo.keys#NIL DO
index: IndexInfo ← NEW[IndexInfoRec ← [key: oldinfo.keys.first, file: oldinfo.indexNames.first]];
info.indices ← CONS[index, info.indices];
oldinfo.keys ← oldinfo.keys.rest;
oldinfo.indexNames ← oldinfo.indexNames.rest;
ENDLOOP;
info.indices ← ReverseIndexList[info.indices];
};
ReverseLogList: PROC [list: LIST OF LogInfo] RETURNS [LIST OF LogInfo] ~ {
new, temp: LIST OF LogInfo ← NIL;
UNTIL list = NIL DO
temp ← list;
list ← list.rest;
temp.rest ← new;
new ← temp;
ENDLOOP;
RETURN[new];
};
ReverseIndexList: PROC [list: LIST OF IndexInfo] RETURNS [LIST OF IndexInfo] ~ {
new, temp: LIST OF IndexInfo ← NIL;
UNTIL list = NIL DO
temp ← list;
list ← list.rest;
temp.rest ← new;
new ← temp;
ENDLOOP;
RETURN[new];
};
END.
Doug Terry, January 28, 1987 10:50:31 am PST
changes to: DIRECTORY, IMPORTS
Doug Terry, January 28, 1987 2:21:21 pm PST
changes to: DIRECTORY, IMPORTS
Doug Terry, January 28, 1987 3:44:12 pm PST
changes to: Describe2, ReverseLogList, DIRECTORY, IMPORTS, ReverseLogList