AEToCrAE.mesa
Carl Hauser, November 9, 1987 4:59:29 pm PST
DIRECTORY
AlpineEnvironment,
AlpineEnvironmentP2201V1;
AEToCrAE: CEDAR DEFINITIONS
~ BEGIN
OPEN AE: AlpineEnvironment, CrAE: AlpineEnvironmentP2201V1;
Principal: PROC [in: AE.Principal] RETURNS [out: CrAE.Principal] ~ INLINE {
RETURN[in]
};
FileStore: PROC [in: AE.FileStore] RETURNS [out: CrAE.FileStore] ~ INLINE {
RETURN[in]
};
RName: PROC [in: AE.RName] RETURNS [out: CrAE.RName] ~ INLINE {
RETURN[in]
};
OwnerName: PROC [in: AE.OwnerName] RETURNS [out: CrAE.OwnerName] ~ INLINE {
RETURN[in]
};
AccessList: PROC [in: AE.AccessList] RETURNS [out: CrAE.AccessList] ~ INLINE {
count: INT ← 0;
FOR temp: AE.AccessList ← in, temp.rest UNTIL temp = NIL DO
count ← count.SUCC;
ENDLOOP;
out ← NEW[CrAE.AccessListObject[count]];
count ← 0;
FOR temp: AE.AccessList ← in, temp.rest UNTIL temp = NIL DO
out[count] ← RName[temp.first];
count ← count.SUCC;
ENDLOOP;
};
VolOrVolGroupID: PROC [in: AE.VolOrVolGroupID] RETURNS [out: CrAE.VolOrVolGroupID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
VolumeID: PROC [in: AE.VolumeID] RETURNS [out: CrAE.VolumeID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
VolumeIDs: PROC [in: LIST OF AE.VolumeID] RETURNS [out: CrAE.VolumeIDs] ~ INLINE {
count: INT ← 0;
FOR temp: LIST OF AE.VolumeID ← in, temp.rest UNTIL temp = NIL DO
count ← count.SUCC;
ENDLOOP;
out ← NEW[CrAE.VolumeIDsObject[count]];
count ← 0;
FOR temp: LIST OF AE.VolumeID ← in, temp.rest UNTIL temp = NIL DO
out[count] ← VolumeID[temp.first];
count ← count.SUCC;
ENDLOOP;
};
VolumeGroupID: PROC [in: AE.VolumeGroupID] RETURNS [out: CrAE.VolumeGroupID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
FileID: PROC [in: AE.FileID] RETURNS [out: CrAE.FileID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
UniversalFile: PROC [in: AE.UniversalFile] RETURNS [out: CrAE.UniversalFile] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
PageNumber: PROC [in: AE.PageNumber] RETURNS [out: CrAE.PageNumber] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
PageCount: PROC [in: AE.PageCount] RETURNS [out: CrAE.PageCount] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
PageRun: PROC [in: AE.PageRun] RETURNS [out: CrAE.PageRun] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
Property: PROC [in: AE.Property] RETURNS [out: CrAE.Property] ~ INLINE {
out ← SELECT in FROM
byteLength => byteLength,
createTime => createTime,
highWaterMark => highWaterMark,
modifyAccess => modifyAccess,
owner => owner,
readAccess => readAccess,
stringName => stringName,
version => version,
ENDCASE => ERROR;
};
PropertySet: PROC [in: PACKED ARRAY AE.Property OF BOOLEAN] RETURNS [out: CrAE.PropertySet] ~ INLINE {
FOR prop: AE.Property IN AE.Property DO
out[LOOPHOLE[Property[prop]]] ← in[prop];
ENDLOOP;
};
PropertyValuePair: PROC [in: AE.PropertyValuePair] RETURNS [out: CrAE.PropertyValuePair] ~ TRUSTED INLINE {
WITH pvp: in SELECT FROM
byteLength => out ← NEW[CrAE.PropertyValuePairObject[byteLength] ← [byteLength[byteLength ~ ByteCount[pvp.byteLength]]]];
createTime => out ← NEW[CrAE.PropertyValuePairObject[createTime] ← [createTime[createTime ~ LOOPHOLE[pvp.createTime]]]];
highWaterMark => out ← NEW[CrAE.PropertyValuePairObject[highWaterMark] ← [highWaterMark[highWaterMark ~ PageCount[pvp.highWaterMark]]]];
modifyAccess => out ← NEW[CrAE.PropertyValuePairObject[modifyAccess] ← [modifyAccess[modifyAccess ~ AccessList[pvp.modifyAccess]]]];
owner => out ← NEW[CrAE.PropertyValuePairObject[owner] ← [owner[owner ~ OwnerName[pvp.owner]]]];
readAccess => out ← NEW[CrAE.PropertyValuePairObject[readAccess] ← [readAccess[readAccess ~ AccessList[pvp.readAccess]]]];
stringName => out ← NEW[CrAE.PropertyValuePairObject[stringName] ← [stringName[stringName ~ pvp.stringName]]];
version => out ← NEW[CrAE.PropertyValuePairObject[version] ← [version[version ~ FileVersion [pvp.version]]]];
ENDCASE => ERROR;
};
Properties: PROC [in: LIST OF AE.PropertyValuePair] RETURNS [out: CrAE.Properties] ~ INLINE {
count: INT ← 0;
FOR temp: LIST OF AE.PropertyValuePair ← in, temp.rest UNTIL temp = NIL DO
count ← count.SUCC;
ENDLOOP;
out ← NEW[CrAE.PropertiesObject[count]];
count ← 0;
FOR temp: LIST OF AE.PropertyValuePair ← in, temp.rest UNTIL temp = NIL DO
out[count] ← PropertyValuePair[temp.first];
count ← count.SUCC;
ENDLOOP;
};
ByteCount: PROC [in: AE.ByteCount] RETURNS [out: CrAE.ByteCount] ~ INLINE {
RETURN[in];
};
FileVersion: PROC [in: AE.FileVersion] RETURNS [out: CrAE.FileVersion] ~ INLINE {
RETURN[in];
};
OpenFileID: PROC [in: AE.OpenFileID] RETURNS [out: CrAE.OpenFileID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
AccessRights: PROC [in: AE.AccessRights] RETURNS [out: CrAE.AccessRights] ~ INLINE {
out ← SELECT in FROM
readOnly => readOnly,
readWrite => readWrite,
ENDCASE => ERROR;
};
LockMode: PROC [in: AE.LockMode] RETURNS [out: CrAE.LockMode] ~ INLINE {
out ← SELECT in FROM
none => none,
read => read,
update => update,
write => write,
readIntendUpdate => readIntendUpdate,
readIntendWrite => readIntendWrite,
intendRead => intendRead,
intendUpdate => intendUpdate,
intendWrite => intendWrite,
ENDCASE => ERROR;
};
LockOption: PROC [in: AE.LockOption] RETURNS [out: CrAE.LockOption] ~ INLINE {
out ← [mode ~ LockMode[in.mode], ifConflict ~ SELECT in.ifConflict FROM
wait => wait,
fail => fail,
ENDCASE => ERROR];
};
RecoveryOption: PROC [in: AE.RecoveryOption] RETURNS [out: CrAE.RecoveryOption] ~ INLINE {
out ← SELECT in FROM
log => log,
noLog => noLog,
ENDCASE => ERROR;
};
ReferencePattern: PROC [in: AE.ReferencePattern] RETURNS [out: CrAE.ReferencePattern] ~ INLINE {
out ← SELECT in FROM
random => random,
sequential => sequential,
ENDCASE => ERROR;
};
OwnerProperty: PROC [in: AE.OwnerProperty] RETURNS [out: CrAE.OwnerProperty] ~ INLINE {
out ← SELECT in FROM
createAccessList => createAccessList,
modifyAccessList => modifyAccessList,
quota => quota,
spaceInUse => spaceInUse,
rootFile => rootFile,
ENDCASE => ERROR;
};
OwnerPropertyValuePair: PROC [in: AE.OwnerPropertyValuePair] RETURNS [out: CrAE.OwnerPropertyValuePair] ~ TRUSTED INLINE {
WITH opvp: in SELECT FROM
createAccessList => out ← NEW[CrAE.OwnerPropertyValuePairObject[createAccessList] ← [createAccessList[AccessList[opvp.createAccessList]]]];
modifyAccessList => out ← NEW[CrAE.OwnerPropertyValuePairObject[modifyAccessList] ← [modifyAccessList[AccessList[opvp.modifyAccessList]]]];
quota => out ← NEW[CrAE.OwnerPropertyValuePairObject[quota] ← [quota[PageCount[opvp.quota]]]];
spaceInUse => out ← NEW[CrAE.OwnerPropertyValuePairObject[spaceInUse] ← [spaceInUse[PageCount[opvp.spaceInUse]]]];
rootFile => out ← NEW[CrAE.OwnerPropertyValuePairObject[rootFile] ← [rootFile[UniversalFile[opvp.rootFile]]]];
ENDCASE => ERROR;
};
OwnerPropertySet: PROC [in: AE.OwnerPropertySet] RETURNS [out: CrAE.OwnerPropertySet] ~ INLINE {
FOR prop: AE.OwnerProperty IN AE.OwnerProperty DO
out[LOOPHOLE[OwnerProperty[prop]]] ← in[prop];
ENDLOOP;
};
OwnerProperties: PROC [in: LIST OF AE.OwnerPropertyValuePair] RETURNS [out: CrAE.OwnerProperties] ~ INLINE {
count: INT ← 0;
FOR temp: LIST OF AE.OwnerPropertyValuePair ← in, temp.rest UNTIL temp = NIL DO
count ← count.SUCC;
ENDLOOP;
out ← NEW[CrAE.OwnerPropertiesObject[count]];
count ← 0;
FOR temp: LIST OF AE.OwnerPropertyValuePair ← in, temp.rest UNTIL temp = NIL DO
out[count] ← OwnerPropertyValuePair[temp.first];
count ← count.SUCC;
ENDLOOP;
};
TransID: PROC [in: AE.TransID] RETURNS [out: CrAE.TransID] ~ INLINE {
RETURN[LOOPHOLE[in]];
};
Outcome: PROC [in: AE.Outcome] RETURNS [out: CrAE.Outcome] ~ INLINE {
out ← SELECT in FROM
abort => abort,
commit => commit,
unknown => unknown,
ENDCASE => ERROR
};
CommitOrAbort: PROC [in: AE.CommitOrAbort] RETURNS [out: CrAE.CommitOrAbort] ~ INLINE {
out ← SELECT in FROM
abort => abort,
commit => commit,
ENDCASE => ERROR
};
WorkerState: PROC [in: AE.WorkerState] RETURNS [out: CrAE.WorkerState] ~ INLINE {
out ← SELECT in FROM
notReady => notReady,
readOnlyReady => readOnlyReady,
ready => ready,
ENDCASE => ERROR
};
NeededAccess: PROC [in: AE.NeededAccess] RETURNS [out: CrAE.NeededAccess] ~ INLINE {
out ← SELECT in FROM
alpineWheel => alpineWheel,
fileModify => fileModify,
fileRead => fileRead,
handleReadWrite => handleReadWrite,
ownerCreate => ownerCreate,
ownerEntry => ownerEntry,
spaceQuota => spaceQuota,
ENDCASE => ERROR
};
OperationFailure: PROC [in: AE.OperationFailure] RETURNS [out: CrAE.OperationFailure] ~ INLINE {
out ← SELECT in FROM
busy => busy,
damagedLeaderPage => damagedLeaderPage,
duplicateOwner => duplicateOwner,
duplicateVolumeGroup => duplicateVolumeGroup,
duplicateVolume => duplicateVolume,
inconsistentDescriptor => inconsistentDescriptor,
volumeFragmented => volumeFragmented,
insufficientSpace => insufficientSpace,
nonexistentFilePage => nonexistentFilePage,
notAlpineWheel => notAlpineWheel,
ownerDatabaseFull => ownerDatabaseFull,
ownerFileFormatOrVolGroupMismatch => ownerFileFormatOrVolGroupMismatch,
ownerRecordFull => ownerRecordFull,
ownerRecordInUse => ownerRecordInUse,
quotaExceeded => quotaExceeded,
regServersUnavailable => regServersUnavailable,
spaceInUseByThisOwner => spaceInUseByThisOwner,
tooManyRNames => tooManyRNames,
totalQuotaExceeded => totalQuotaExceeded,
unwritableProperty => unwritableProperty,
ENDCASE => ERROR
};
LockFailure: PROC [in: AE.LockFailure] RETURNS [out: CrAE.LockFailure] ~ INLINE {
out ← SELECT in FROM
conflict => conflict,
timeout => timeout,
ENDCASE => ERROR
};
UnknownType: PROC [in: AE.UnknownType] RETURNS [out: CrAE.UnknownType] ~ INLINE {
out ← SELECT in FROM
coordinator => coordinator,
fileID => fileID,
openFileID => openFileID,
owner => owner,
transID => transID,
volumeID => volumeID,
volumeGroupID => volumeGroupID,
ENDCASE => ERROR
};
END.