AdobeCommonImplE.mesa
Copyright Ó 1983, 1985, 1986, 1987, 1988 , 1992by Xerox Corporation. All rights reserved.
MXF  29-Jul-83 14:17:45
RSF  17-Apr-86 20:23:54
JCS  10-Oct-85 16:47:23
RLC  25-Feb-88 18:18:25
Philip James, January 13, 1992 11:56 am PST
Christian Jacobi, April 7, 1992 5:36 pm PDT
DIRECTORY
AccessCH USING [Problem],
AdobeCommon USING [--ChangeSystem, DataHandle, FreeHintStrings, GetDataSW, GetDescList, --Handle, InitialSetStatus--, LockedSysDescPtr--, PostMessage, ReportFields, ReportFieldsSeq, SetStatus--, StringArray--],
AdobeCommonInternal USING [ClickToConfirm, InstanceDataHandle],
AdobeOps USING [ARNumber, ARSystemHandle--, DefaultInfoObject--, FieldList, nilARNumber, QLHandle, QueryList, SetOfARs, ToolType, UserOrderSequence, UserSpecifiedOrder],
AdobeServer USING [Error, GetSystemDefaultUserFile],
AdobeP75V2,
AdobeToolContext,
ARAccess,
Ascii USING [NUL],
BasicTime USING [GMT],
Convert USING [CardFromRope, RopeFromTime],
FormSW USING [ItemHandle, line0, MenuProcType, ProcType],
IO USING [Close, EndOf, GetChar, PutChar, STREAM],
MFile USING [Acquire, Delete, Handle],
MStream USING [WriteOnly],
CmFile USING [
Close, Error, FindSection, FreeString, Handle, NextItem, Open],
CrRPC USING [BulkDataSink],
NSName USING [maxFullNameLength],
PFS USING [Delete, PathFromRope, StreamOpen],
Put USING [CR, Text],
Rope USING [Cat, Concat, Equal, Fetch, Length, Substr, ROPE],
Stream USING [Delete, Handle],
String USING [
AppendExtensionIfNeeded, CopyToNewString, Equal, Equivalent,
Length, MakeString, StringToDecimal],
System USING [nullNetworkAddress],
Token USING [
Alphabetic, AlphaNumeric, Brackets, Decimal, Filtered,
FilterProcType, FreeTokenString, FreeStringHandle, Line,
MaybeQuoted, NonWhiteSpace, Handle, StringToHandle, SyntaxError],
XNSAdobeClientOps USING [GetSystemDefaultUserFile, StubError, UnknownAddress];
--Window USING [Handle, Place];
AdobeCommonImplE: CEDAR PROGRAM
IMPORTS
AccessCH, AdobeCommon, --AdobeCommonInternal, AdobeOps, AdobeServer,
AdobeToolContext, ARAccess, Convert--, MFile, MStream--, CmFile, IO, PFS --Put, --, Rope--Stream,
--String--, Token, XNSAdobeClientOps
EXPORTS AdobeCommon =
BEGIN
sequence used for Table Lookup
ValueSequencePtr: TYPE = REF ValueSequence;
ValueSequence: TYPE = RECORD [
seq: SEQUENCE length: CARDINAL OF Rope.ROPE];
InvalidFieldName: SIGNAL = CODE;
SyntaxError: SIGNAL = CODE;
CatchErrors: PUBLIC PROCEDURE [
h: AdobeCommon.Handle, --item: FormSW.ItemHandle, index: CARDINAL,
--windowData: AdobeCommon.DataHandle, --proc: PROC[h: AdobeCommon.Handle]] = {
errorMessage: Rope.ROPE;
BEGIN
ENABLE {
AccessCH.Problem => {
SELECT type FROM
noClearinghouse =>
errorMessage ¬ "Clearinghouse is unavailable.";
authProblem => errorMessage ¬ "Authentication problem.";
badDatabaseName => errorMessage ¬ "badDatabaseName.";
badDatabaseFile => errorMessage ¬ "Can't open database file.";
accessProblem =>
errorMessage ¬
"access problem in reaching clearinghouse.";
ENDCASE => errorMessage ¬ "AccessCH.Problem"};
ARAccess.Error => {
SELECT why FROM
accessDenied => errorMessage ← "Access Denied! ";
accessUndetermined =>
errorMessage ← "Can't determine if user has access";
arNotFound => errorMessage ← "AR not found! ";
authError => errorMessage ← "Authentication Error";
communicationError =>
errorMessage ← "File service unavailable or down";
crashDuringCheckOut =>
errorMessage ←
"Checkout session lost. You must check the AR out again.";
currentlyCheckedOut => {
iData: AdobeCommonInternal.InstanceDataHandle ←
windowData.instanceData;
WITH iData SELECT FROM
submit =>
errorMessage ←
"Another session has this directory locked.";
ENDCASE =>
errorMessage ←
"Sorry, this AR is already checked out by another. "};
directoryFull =>
errorMessage ← "Directory is full! Contact support.";
fileServerFull =>
errorMessage ← "File Server is full! Contact support.";
invalidARNumber => errorMessage ← "Invalid AR Number! ";
invalidLogin => errorMessage ← "Invalid Login.";
ENDCASE => REJECT;
GOTO ErrorExit};
AdobeToolContext.StreamError => {
errorMessage ¬
"AR File contains bad data - contact support!";
GOTO ErrorExit};
AdobeToolContext.EnumError => {
errorMessage ¬
"AR File contains an invalid enumerated value - contact support!";
GOTO ErrorExit};
AdobeServer.Error => {
SELECT why FROM
communicationError =>
errorMessage ← "Problems communicating with Adobe service.";
unknownSystem =>
errorMessage ← "Unknown Adobe system.";
cantDetermineLocOfARs =>
errorMessage ← "Can't determine location of AR files.";
illegalLogin => errorMessage ← "Invalid login.";
systemAlreadyExists => errorMessage ← "systemAlreadyExists."; -- should never happen
fileNotFound => errorMessage ← "File not found.";
serverUnreachable =>
errorMessage ← "Unable to reach Adobe server.";
serverDown => errorMessage ← "Adobe server is down.";
noAdobeServiceAtServer =>
errorMessage ← "Adobe service not running on server.";
courierTimedOut => errorMessage ← "Courier timed out.";
parameterInconsistency =>
errorMessage ←
"Parameter Inconsistency - this tool and the Adobe service aren't compatible!";
obsoleteVersion => GOTO GetNewSystemDescription;
systemNotRegistered => errorMessage ← "systemNotRegistered."; -- should never happen
sysDescChanging =>
errorMessage ← "The Adobe database is changing. Try again later.";
others => errorMessage ← "Unknown Adobe service problem.";
tooManyConnections => errorMessage ← "Too many connections to Adobe service. Try again later.";
ENDCASE => errorMessage ← "Unexpected Adobe service problem.";
GOTO ErrorExit};
ABORTED => {errorMessage ¬ "Aborted!"; GOTO ErrorExit}};
proc[h];
proc[sw, item, index];
EXITS
GetNewSystemDescription => {
sentinal: AdobeCommon.LockedSysDescPtr ←
AdobeCommon.GetDescList[];
AdobeCommon.PostMessage[
windowData.msgSW, TRUE,
"This system description has become obsolete! "];
AdobeCommon.PostMessage[
windowData.msgSW, TRUE,
"Retrieve new system description? Click to confirm."];
IF AdobeCommonInternal.ClickToConfirm[windowData, TRUE] THEN {
windowData.isBusy ← TRUE;
AdobeCommon.PostMessage[
windowData.msgSW, FALSE,
"Retrieving new system description..."];
AdobeCommon.ChangeSystem[
windowData, windowData.system, TRUE]}};
ErrorExit => {
AdobeCommon.PostMessage[h, TRUE, errorMessage];
h.isBusy ¬ FALSE};
END};
ReadTil: PROCEDURE [r: Rope.ROPE, currentIndex: CARD, c: CHAR] RETURNS [newIndex: CARD] ~ {
i: INT;
FOR i ¬ currentIndex + 1, i + 1 UNTIL i >= r.Length[] OR r.Fetch[i] = c DO ENDLOOP;
RETURN[i];
};
AdobeTimeRope: PUBLIC PROCEDURE [time: BasicTime.GMT] RETURNS [timeRope: Rope.ROPE ¬ NIL] = {
cedarTime: Rope.ROPE ¬ Convert.RopeFromTime[time, years, seconds, FALSE, FALSE, FALSE];
index, tmp: CARD ¬ 0;
timeRope ¬ timeRope.Cat["-", Rope.Substr[cedarTime, index, 3], "-"];
index ¬ ReadTil[cedarTime, index, ' ] + 1;
tmp ¬ ReadTil[cedarTime, index, ',] ;
timeRope ¬ Rope.Concat[Rope.Substr[cedarTime, index, tmp - index], timeRope];
index ¬ tmp + 4;
timeRope ¬ timeRope.Cat[Rope.Substr[cedarTime, index, 2], " "];
index ¬ index + 3;
tmp ¬ ReadTil[cedarTime, index, 'X];
timeRope ¬ timeRope.Concat[Rope.Substr[cedarTime, index, tmp-index]];
};
SetFSWOrderAndDefaultFromUserFile: PUBLIC PROCEDURE [
systemName: Rope.ROPE, arSH: AdobeOps.ARSystemHandle, server: Rope.ROPE] =
BEGIN
fL: AdobeOps.FieldList ¬ arSH.fieldList;
localName: Rope.ROPE ¬ GetLocalName[systemName];
userFile: Rope.ROPE ¬ localName;
cmH: CmFile.Handle ¬ NIL;
noUserFile: BOOLEAN ¬ FALSE;
localName ¬ NIL;
FreeLocalName[localName];
userFile ¬ ConvertToUserFileName[userFile];
userFile ¬ userFile.Concat[".user"];
[] ← String.AppendExtensionIfNeeded[
@userFile, ".user", AdobeOps.z];
open local user file
cmH ¬ CmFile.Open[
userFile !
CmFile.Error =>
IF code = fileNotFound THEN {
[cmH, noUserFile] ¬ GetUserFileFromService[
systemName, userFile];
IF noUserFile THEN CONTINUE ELSE RETRY}];
FOR tool: AdobeOps.ToolType IN AdobeOps.ToolType DO
free old value
AdobeOps.z.FREE[@arSH.formSWOrderArray[tool]];
IF noUserFile THEN
arSH.formSWOrderArray[tool] ¬ AllDisplayed[fL.length]
ELSE
arSH.formSWOrderArray[tool] ¬ SearchUserFileForDisplayed[
cmH, fL, tool];
ENDLOOP;
use IF only until can go to service for noUserFile
IF ~noUserFile THEN {
cmH ¬ CmFile.Close[cmH];
};
AdobeOps.z.FREE[@userFile];
END;
AllDisplayed: PROCEDURE [length: CARDINAL]
RETURNS [formSWOrder: AdobeOps.UserSpecifiedOrder] =
BEGIN
ENABLE UNWIND => NULL; --AdobeOps.z.FREE[@formSWOrder];
formSWOrder ¬ NEW[AdobeOps .UserOrderSequence[length]];
FOR i: CARDINAL IN [0..length) DO
formSWOrder[i] ¬ i;
do not need to set place, width positions in DefaultInfo
because the default values are fine.
ENDLOOP;
END;
SearchUserFileForDisplayed: PROCEDURE [cmH: CmFile.Handle, fL: AdobeOps.FieldList, tool: AdobeOps.ToolType] RETURNS [formSWOrder: AdobeOps.UserSpecifiedOrder] = BEGIN
toolNames: ARRAY AdobeOps.ToolType OF Rope.ROPE ¬ [ "Edit", "Submit", "Report", "Query", "Sort", "QueryList"];
isADefault: BOOLEAN ¬ FALSE;
values: ValueSequencePtr ¬ NIL;
name, value, default: Rope.ROPE ¬ NIL;
TempOrderType: TYPE = RECORD [
index: CARDINAL ¬ 0, order: AdobeOps.UserSpecifiedOrder ¬ NIL];
tempOrder: TempOrderType ¬ [];
incr: CARDINAL = 1;
TruncateSequence: PROCEDURE [order: TempOrderType]
RETURNS [formSWOrder: AdobeOps.UserSpecifiedOrder] = {
IF tool # report THEN {
formSWOrder ¬ NEW[
AdobeOps .UserOrderSequence[order.index]];
FOR i: CARDINAL IN [0..formSWOrder.length) DO
formSWOrder[i] ¬ order.order[i]; ENDLOOP}
ELSE {
hasOrder: AdobeCommon.ReportFields ¬ NEW[
AdobeCommon .ReportFieldsSeq[order.order.length]];
reportCount: CARDINAL ¬ 0;
FOR i: CARDINAL IN [0..hasOrder.length) DO
hasOrder[i] ¬ FALSE; ENDLOOP;
formSWOrder ¬ NEW[
AdobeOps .UserOrderSequence[order.order.length]];
FOR i: CARDINAL IN [0..order.order.length) DO
IF order.order[i] # LAST[CARDINAL] THEN {
formSWOrder[reportCount] ¬ order.order[i];
hasOrder[order.order[i]] ¬ TRUE;
reportCount ¬ reportCount + 1};
ENDLOOP;
FOR i: CARDINAL IN [0..order.order.length) DO
IF ~hasOrder[i] THEN {
formSWOrder[reportCount] ¬ i;
reportCount ¬ reportCount + 1};
ENDLOOP;
AdobeOps.z.FREE[@hasOrder]
};
AdobeOps.z.FREE[@order.order];
};
IF CmFile.FindSection[h: cmH, title: toolNames[tool]] THEN
BEGIN
ENABLE
UNWIND => {
AdobeOps.z.FREE[@tempOrder.order];
name ¬ CmFile.FreeString[name];
value ¬ CmFile.FreeString[value];
IF values # NIL THEN {
AdobeOps.z.FREE[@values[0]];
AdobeOps.z.FREE[@values[1]];
AdobeOps.z.FREE[@values]
}};
tempOrder ¬ [
index: 0,
order: NEW[AdobeOps .UserOrderSequence[fL.length]]];
IF tool = report THEN
FOR i: CARDINAL IN [0..tempOrder.order.length) DO
tempOrder.order[i] ¬ LAST[CARDINAL]; ENDLOOP;
[name, value] ¬ CmFile.NextItem[h: cmH];
WHILE name # NIL DO
fLIndex: CARDINAL ¬ FindFieldInFL[
name, fL !
InvalidFieldName => {
Put.Text[NIL, "Invalid field name: \""];
Put.Text[NIL, name];
Put.Text[NIL, "\" found in .user file."];
Put.CR[NIL];
name ¬ CmFile.FreeString[name];
value ¬ CmFile.FreeString[value];
[name, value] ¬ CmFile.NextItem[h: cmH];
LOOP}];
get default information
[fL[fLIndex].defaultInfo[tool].place, fL[fLIndex].defaultInfo[
tool].width, default] ¬ ParseValueToken[
value !
SyntaxError => {
Put.Text[NIL, "Syntax Error in .user entry for "];
Put.Text[NIL, name];
Put.Text[NIL, ". Defaulted to all displayed."];
GOTO syntaxError}];
<<IF fL[fLIndex].defaultInfo[tool].width # 0 THEN
fL[fLIndex].defaultInfo[tool].width ¬ MAX[
fL[fLIndex].defaultInfo[tool].width, name.length]; fix AR9504>>
IF default # NIL THEN
IF --there is no systemMust value --
(fL[fLIndex].defaultInfo[tool].default.Length = 0) THEN
fL[fLIndex].defaultInfo[tool].default ¬ default
ELSE {}; --AdobeOps.z.FREE[@default];
IF tool # report THEN {
tempOrder.order[tempOrder.index] ¬ fLIndex;
tempOrder.index ¬ tempOrder.index + incr}
ELSE {
IF fL[fLIndex].defaultInfo[tool].place.ord # 0
AND CARDINAL[fL[fLIndex].defaultInfo[tool].place.ord] <=
fL.length THEN {
tempOrder.order[fL[fLIndex].defaultInfo[tool].place.ord - 1]
¬ fLIndex;
tempOrder.index ¬ tempOrder.index + incr}};
name ¬ CmFile.FreeString[name];
value ¬ CmFile.FreeString[value];
[name, value] ¬ CmFile.NextItem[h: cmH];
ENDLOOP;
name ¬ CmFile.FreeString[name];
value ¬ CmFile.FreeString[value];
RETURN[TruncateSequence[tempOrder]]
END
ELSE RETURN[AllDisplayed[fL.length]];
EXITS syntaxError => RETURN[AllDisplayed[fL.length]];
END;
<< Not Apparently used
GetDefault: PROCEDURE [cmH: PFS.OpenFile] RETURNS [default: Rope.ROPE] =
BEGIN
tempString: Rope.ROPE ← Token.Filtered[cmH, NIL, Token.Alphabetic];
default ← String.CopyToNewString[tempString, AdobeOps.z];
tempString ← Token.FreeTokenString[tempString];
END; >>
FindFieldInFL: PROCEDURE [name: Rope.ROPE, fL: AdobeOps.FieldList]
RETURNS [index: CARDINAL] =
BEGIN
FOR i: CARDINAL IN [0..fL.length) DO
IF Rope.Equal[name, fL[i].name] THEN RETURN[i];
ENDLOOP;
ERROR InvalidFieldName;
END;
ParseValueToken: PROCEDURE [token: Rope.ROPE]
RETURNS [
place: AdobeP75V2.Coordinate, width: CARDINAL,
default: Rope.ROPE ¬ NIL] =
BEGIN
index: CARDINAL ¬ 0;
labels: ARRAY [0..2) OF Rope.ROPE ¬ ["x", "y"];
sH: Token.Handle ¬ NIL;
temp, string: Rope.ROPE ¬ NIL;
thereIsADefault: BOOLEAN ¬ FALSE;
MustBeBracketed: Token.FilterProcType = {RETURN[FALSE]};
parse the attribute's value
IF (token.Length > 0) AND (token.Fetch[0] = '[) THEN
BEGIN
ENABLE
UNWIND => {
[] ¬ Token.FreeTokenString[string];
[] ¬ Token.FreeStringHandle[sH];
};
sH ¬ Token.StringToHandle[token];
strip off brakets
string ¬ Token.MaybeQuoted[
sH, NIL, MustBeBracketed, Token.Brackets];
[place, width] ¬ GetXYFromString[
string ! Token.SyntaxError => ERROR SyntaxError];
string ¬ Token.FreeTokenString[string];
IF sH.break # Ascii.NUL THEN
BEGIN
temp ¬ Token.MaybeQuoted[sH, NIL, Token.Line];
default ¬ temp;
default ← String.CopyToNewString[temp, AdobeOps.z];
temp ¬ Token.FreeTokenString[temp];
END;
sH ¬ Token.FreeStringHandle[sH];
END
ELSE ERROR SyntaxError;
END;
GetXYFromString: PROCEDURE [string: Rope.ROPE]
RETURNS [place: AdobeP75V2.Coordinate, width: CARDINAL ¬ 0] =
BEGIN
temp: Rope.ROPE ¬ NIL;
sh: Token.Handle ¬ Token.StringToHandle[string];
gotOne: BOOLEAN ¬ FALSE;
Numeric: Token.FilterProcType =
BEGIN
RETURN[SELECT c FROM IN ['0..'9] => TRUE, ENDCASE => FALSE];
END;
DO
ENABLE
UNWIND => {
[] ¬ Token.FreeTokenString[temp];
[] ¬ Token.FreeStringHandle[sh]};
temp ¬ Token.Filtered[sh, NIL, Token.Alphabetic];
': was consumed and now is in sh.break
IF sh.break = Ascii.NUL THEN EXIT;
SELECT TRUE FROM
Rope.Equal[temp, "x"] => place.ord ¬ Token.Decimal[h: sh];
Rope.Equal[temp, "y"] =>
BEGIN
temp ¬ Token.FreeTokenString[temp];
temp ¬ Token.MaybeQuoted[
h: sh, data: NIL, filter: Token.AlphaNumeric];
IF temp.Length > 4 THEN
BEGIN
tempHandle: Token.Handle ¬ Token.StringToHandle[temp];
lineNumStr: Rope.ROPE ¬ Token.Filtered[
h: tempHandle, data: NIL, filter: Numeric,
skip: nonToken];
place.co ¬
2 --FormSW.line0-- - Convert.CardFromRope[lineNumStr]; --String.StringToDecimal[lineNumStr];
lineNumStr ¬ Token.FreeTokenString[lineNumStr];
[] ¬ Token.FreeStringHandle[tempHandle];
END
ELSE place.co ¬ Convert.CardFromRope[temp]; --String.StringToDecimal[temp];
END;
Rope.Equal[temp, "w"] => width ¬ Token.Decimal[h: sh];
ENDCASE => ERROR SyntaxError;
temp ¬ Token.FreeTokenString[temp];
ENDLOOP;
[] ¬ Token.FreeStringHandle[sh];
RETURN[place, width];
END;
GetUserFileFromService: PROCEDURE [systemName, userFileName, server: Rope.ROPE ¬ NIL]
RETURNS [cmH: CmFile.Handle, noUserFile: BOOLEAN ¬ FALSE] =
BEGIN
userSH: IO.STREAM ¬ PFS.StreamOpen[PFS.PathFromRope[userFileName], write];
MStream.WriteOnly[
name: userFileName, release: [], type: text];
{
ENABLE
XNSAdobeClientOps.UnknownAddress,
XNSAdobeClientOps.StubError => GOTO noUserFileExit;
GSDUFile: CrRPC.BulkDataSink = {
IF checkAbort[h] THEN {
noUserFile ¬ TRUE;
RETURN[FALSE];
};
IF IO.EndOf[s] THEN {
noUserFile ¬ TRUE;
RETURN[FALSE];
};
WHILE NOT IO.EndOf[s] DO
IO.PutChar[userSH, IO.GetChar[s]];
ENDLOOP;
RETURN[FALSE];
};
noUserFile ← (--
XNSAdobeClientOps.GetSystemDefaultUserFile[
server: server--System.nullNetworkAddress--, system: systemName, to: GSDUFile];
= 0);
IO.Close[userSH];
Stream.Delete[userSH];
IF noUserFile THEN
PFS.Delete[PFS.PathFromRope[userFileName]];
MFile.Delete[MFile.Acquire[userFileName, delete, []]];
EXITS
noUserFileExit => {
IF userSH # NIL THEN IO.Close[userSH]; --Stream.Delete[userSH];
PFS.Delete[PFS.PathFromRope[userFileName]];
MFile.Delete[MFile.Acquire[userFileName, delete, []]];
RETURN[NIL, TRUE]}};
END;
ConvertToUserFileName: PROCEDURE [userFileName: Rope.ROPE] RETURNS [Rope.ROPE ¬ NIL] = {
i, offset: CARDINAL ¬ 0;
newUFN: Rope.ROPE ¬ NIL;
FOR i IN [0.. userFileName.Length) DO
IF userFileName.Fetch[i] # ' THEN
newUFN ¬ ARAccess.AppendChar[newUFN, userFileName.Fetch[i]];
ENDLOOP;
RETURN[newUFN]
};
QLNameHints: PUBLIC FormSW.MenuProcType =
BEGIN
data: AdobeCommon.DataHandle ← AdobeCommon.GetDataSW[sw];
arSH: AdobeOps.ARSystemHandle;
hintsLength, hintsIndex: CARDINAL ← 0;
hintSeq: REF AdobeCommon.StringArray;
list: AdobeOps.QLHandle;
CountOtherQLs: PROCEDURE RETURNS [count: CARDINAL ← 0] =
BEGIN
list: AdobeOps.QLHandle ← arSH.otherQLs;
WHILE list # NIL DO
count ← count + 1; list ← list.next; ENDLOOP;
END;
IF data.context = NIL THEN {hints ← NIL; RETURN};
arSH ← data.context.arSH;
freeHintsProc ← AdobeCommon.FreeHintStrings;
replace ← TRUE;
hintsLength ← CountOtherQLs[];
IF arSH.sysQL # NIL OR data.tool = query
OR
(data.tool = queryList AND index = 8
<< AdobeCommon.resultPos>> ) THEN
hintsLength ← hintsLength + 1;
IF hintsLength = 0 THEN {
hintSeq ← AdobeOps.z.NEW[AdobeCommon .StringArray[1]];
hintSeq[0] ← String.CopyToNewString["", AdobeOps.z];
hints ← DESCRIPTOR[hintSeq];
RETURN};
hintSeq ← AdobeOps.z.NEW[AdobeCommon .StringArray[hintsLength]];
IF arSH.sysQL # NIL OR data.tool = query
OR
(data.tool = queryList AND index = 8
<< AdobeCommon.resultPos>> ) THEN {
hintSeq[0] ← String.CopyToNewString["SysQL", AdobeOps.z];
hintsIndex ← hintsIndex + 1};
list ← arSH.otherQLs;
WHILE list # NIL DO
hintSeq[hintsIndex] ← String.CopyToNewString[
list.qL.name, AdobeOps.z];
hintsIndex ← hintsIndex + 1;
list ← list.next;
ENDLOOP;
hints ← DESCRIPTOR[hintSeq];
END;
GetNextAR: PUBLIC PROCEDURE [
set: AdobeOps.SetOfARs, current: AdobeCommon.SetStatus]
RETURNS [
nextAR: AdobeOps.ARNumber, newStatus: AdobeCommon.SetStatus] =
returning AR=nilARNumber means set exhausted
{
newStatus ¬ current;
IF set = NIL OR set.len = 0 THEN
RETURN[AdobeOps.nilARNumber, newStatus];
IF newStatus = AdobeCommon.InitialSetStatus THEN
RETURN[set[0].startValue, [0, 0]];
IF set[current.setIndex].runLength <= current.runOffset + 1 THEN {
newStatus.runOffset ¬ 0;
newStatus.setIndex ¬ newStatus.setIndex + 1;
IF newStatus.setIndex >= set.len THEN
RETURN[AdobeOps.nilARNumber, newStatus]}
ELSE newStatus.runOffset ¬ newStatus.runOffset + 1;
nextAR ¬ set[newStatus.setIndex].startValue + newStatus.runOffset;
};
GetPreviousAR: PUBLIC PROCEDURE [
set: AdobeOps.SetOfARs, current: AdobeCommon.SetStatus]
RETURNS [
nextAR: AdobeOps.ARNumber, newStatus: AdobeCommon.SetStatus] =
returning AR=0 means set exhausted
BEGIN
newStatus ¬ current;
IF current = AdobeCommon.InitialSetStatus THEN
RETURN[
set[set.len - 1].startValue + set[set.len - 1].runLength - 1,
[
runOffset: CARDINAL[set[set.len - 1].runLength - 1],
setIndex: set.len - 1]];
IF current.runOffset < 1 THEN {
IF newStatus.setIndex = 0 THEN RETURN[0, newStatus];
newStatus.setIndex ¬ newStatus.setIndex - 1;
newStatus.runOffset ¬ CARDINAL[
set[newStatus.setIndex].runLength - 1]}
ELSE newStatus.runOffset ¬ newStatus.runOffset - 1;
nextAR ¬ set[newStatus.setIndex].startValue + newStatus.runOffset;
END;
FindThisQL: PUBLIC PROC[qlName: Rope.ROPE ¬ NIL, arSH: AdobeCommon.Handle] RETURNS [ql: AdobeOps.QueryList ¬ NIL] ~ {
IF Rope.Equal["SysQL", qlName, FALSE] OR qlName = NIL OR qlName.Length = 0 THEN
ql ¬ arSH.systemHandle.sysQL
ELSE
FOR q: AdobeOps.QLHandle ¬ arSH.systemHandle.otherQLs, q.next UNTIL q = NIL DO
IF Rope.Equal[qlName, q.qL.name, FALSE] THEN ql ¬ q.qL;
ENDLOOP;
RETURN[ql];
};
FindThisQL: PUBLIC PROCEDURE [qlName: Rope.ROPE, arSH: AdobeOps.ARSystemHandle]
RETURNS [qlHandle: AdobeOps.QueryList] = {
qlH: AdobeOps.QLHandle;
IF Rope.Equal[qlName, "SysQL", NIL] OR qlName = NIL
OR qlName.length = 0 THEN RETURN[arSH.sysQL];
qlH ← arSH.otherQLs;
WHILE qlH # NIL DO
IF String.Equal[qlName, qlH.qL.name] THEN RETURN[qlH.qL];
qlH ← qlH.next;
ENDLOOP;
RETURN[NIL];
END;
GetLocalName: PROCEDURE [fullName: Rope.ROPE]
RETURNS [localName: Rope.ROPE] = {
i: INT ¬ 0;
localName ¬ NIL; --String.MakeString[AdobeOps.z, fullName.length];
WHILE i < fullName.Length[] AND fullName.Fetch[i] # ':
--AND i < NSName.maxFullNameLength-- DO
localName ¬ ARAccess.AppendChar[localName, fullName.Fetch[i]];
localName[i] ← fullName[i];
i ¬ i + 1;
ENDLOOP;
localName.length ← i
};
FreeLocalName: PROCEDURE [name: Rope.ROPE] = {
AdobeOps.z.FREE[@name]};
END..
RLC   8-Aug-86 18:03:09 MyCmFile ← CmFile
RLC  23-Feb-88 17:20:30 add toomanyconnections
RLC  25-Feb-88 18:18:25 tooManyConnections now a REAL error