AdobeCommonImplC.mesa
Copyright Ó 1990 b, 1992y Xerox Corporation. All rights reserved.
Philip James, June 26, 1991 2:42 pm PDT
DIRECTORY
AdobeCommon USING [AddSystemToKnownSystems, Handle, LocateSystemInKnownSystems, SysList, Systems, SystemsHandle],
AdobeCommonInternal,
AdobeOps USING [ToolType],
Rope USING [Equal, ROPE],
UserProfile USING [ListOfTokens, Number, Token];
AdobeCommonImplC: CEDAR PROGRAM
IMPORTS AdobeCommon, AdobeCommonInternal, Rope, UserProfile
EXPORTS AdobeCommonInternal = {
typedInitialSystem: Rope.ROPE ¬ NIL;
SetTypedInitialSystem: PUBLIC PROCEDURE[r: Rope.ROPE] ~ {
typedInitialSystem ¬ r;
};
ProcessUserDotCM: PUBLIC PROCEDURE [handle: AdobeCommon.Handle] = {
systemName: Rope.ROPE ¬ NIL;
handle.unboundFieldHeight ¬ GetUBFL[];
handle.tool ¬ handle.oldtool ¬ GetToolName[];
handle.knownSystems ¬ GetKnownSystems[];
IF typedInitialSystem # NIL THEN {
systemName ¬ typedInitialSystem;
typedInitialSystem ¬ NIL;
}
ELSE
systemName ¬ GetInitialSystem[];
handle.oldsystem ¬ handle.system ¬
AdobeCommon.LocateSystemInKnownSystems[systemName, handle.knownSystems ! AdobeCommonInternal.SystemNotFound => {AdobeCommon.AddSystemToKnownSystems[systemName, handle.knownSystems];
RETRY}];
IF handle.system # LAST[CARD] THEN
handle.systemName ¬ handle.knownSystems.system[handle.system];
};
GetUBFL: PROCEDURE RETURNS [len: CARD ¬ 3] = {
profileLen: INT ¬ UserProfile.Number[key: "Adobe.InitialUnboundFieldLength", default: 3];
IF profileLen < 2 THEN RETURN[2];
IF profileLen > LAST[CARD] THEN
len ¬ LAST[CARD]
ELSE
len ¬ profileLen;
RETURN[len];
};
GetInitialSystem: PROCEDURE RETURNS [system: Rope.ROPE] = {
system ¬ UserProfile.Token[key: "Adobe.InitialSystem", default: "SUN of System Software:OSBU North:Xerox"];
RETURN[system];
};
GetToolName: PROCEDURE RETURNS [AdobeOps.ToolType] = {
tool: AdobeOps.ToolType ¬ edit;
profileTool: Rope.ROPE ¬ UserProfile.Token[key: "Adobe.InitialTool", default: "Edit"];
SELECT TRUE FROM
Rope.Equal[profileTool, "edit", FALSE] => tool ¬ edit;
Rope.Equal[profileTool, "submit", FALSE] => tool ¬ submit;
Rope.Equal[profileTool, "query", FALSE] => tool ¬ query;
Rope.Equal[profileTool, "queryList", FALSE] => tool ¬ queryList;
Rope.Equal[profileTool, "report", FALSE] => tool ¬ report;
Rope.Equal[profileTool, "sort", FALSE] => tool ¬ sort;
ENDCASE;
RETURN[tool];
};
GetKnownSystems: PROCEDURE
RETURNS [knownSystems: AdobeCommon.SystemsHandle ¬ NIL] = {
count: CARD ¬ 0;
systemsRope: LIST OF Rope.ROPE ¬ UserProfile.ListOfTokens[key: "Adobe.KnownSystems", default: LIST ["SUN of System Software"]];
FOR index: LIST OF Rope.ROPE ¬ systemsRope, index.rest UNTIL index = NIL DO
count ¬ count + 1;
ENDLOOP;
IF count > 0 THEN {
knownSystems ¬ NEW[AdobeCommon.Systems ¬ [0, NEW[AdobeCommon.SysList[count]]]];
knownSystems.next ¬ count;
count ¬ 0;
FOR index: LIST OF Rope.ROPE ¬ systemsRope, index.rest UNTIL index = NIL DO
knownSystems.system[count] ¬ index.first;
count ¬ count + 1;
ENDLOOP;
};
};
}.