X11FontCommandsImpl.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, January 23, 1991 12:53 pm PST
Christian Jacobi, October 9, 1992 0:03 am PDT
Willie-s, November 25, 1991 4:55 pm PST
DIRECTORY
Rope,
Commander,
CommanderOps,
IO,
Process,
X11CommanderOps,
Xl;
X11FontCommandsImpl: CEDAR MONITOR
IMPORTS Commander, CommanderOps, IO, Process, X11CommanderOps, Xl =
BEGIN
ListFontsWithInfoCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
Each: Xl.FontInfoProc = {
ENABLE ABORTED => GOTO Oops; --catch abort to be able to close connection
Process.CheckForAbort[];
IO.PutF1[cmd.out, "%g\n", IO.rope[name]];
IO.PutF[cmd.out, " fontAscent %g fontDescent %g\n", IO.int[info.fontAscent], IO.int[info.fontDescent]];
RETURN [FALSE];
EXITS Oops => RETURN [TRUE]
};
count: INT ¬ Xl.ListFontsWithInfo[connection, Each, pattern, 1000, cmd];
};
pattern: Rope.ROPE;
IF CommanderOps.NumArgs[cmd]#2 THEN {
ERROR CommanderOps.Failed["needs pattern argument"];
};
pattern ¬ CommanderOps.ArgN[cmd, 1];
X11CommanderOps.DoWithConnection[Inner];
};
EnumerateFontsCommand: Commander.CommandProc = {
pattern: Rope.ROPE;
Inner: X11CommanderOps.ConnectionProc = {
Each: Xl.NameProc = {
ENABLE ABORTED => GOTO Oops; --catch abort to be able to close connection
Process.CheckForAbort[];
IO.PutF1[cmd.out, "%g\n", IO.rope[name]];
RETURN [FALSE];
EXITS Oops => RETURN [TRUE]
};
[] ¬ Xl.ListFonts[connection, Each, pattern, 1000];
};
IF CommanderOps.NumArgs[cmd]#2 THEN {
ERROR CommanderOps.Failed["needs pattern argument"];
};
pattern ¬ CommanderOps.ArgN[cmd, 1];
X11CommanderOps.DoWithConnection[Inner];
};
GetFontPathCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
FOR list: LIST OF Rope.ROPE ¬ Xl.GetFontPath[connection], list.rest WHILE list#NIL DO
IO.PutF1[cmd.out, "%g\n", IO.rope[list.first]];
ENDLOOP;
};
X11CommanderOps.DoWithConnection[Inner];
};
ListExtensionsCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
FOR list: LIST OF Rope.ROPE ¬ Xl.ListExtensions[connection], list.rest WHILE list#NIL DO
IO.PutF1[cmd.out, "%g\n", IO.rope[list.first]];
ENDLOOP;
};
X11CommanderOps.DoWithConnection[Inner];
};
ServerInfoCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
info: Xl.InfoRef ¬ Xl.Info[connection];
screenCount: INT ¬ Xl.ScreenCount[connection];
IO.PutF1[cmd.out, "name: %g\n", IO.rope[Xl.ServerName[connection]]];
IO.PutF[cmd.out, "protocol major: %g minor: %g\n", IO.card[info.protocolMajorVersion], IO.card[info.protocolMinorVersion]];
IO.PutF1[cmd.out, "release: %g\n", IO.int[info.releaseNumber]];
IO.PutF1[cmd.out, "vendor: %g\n", IO.rope[info.vendor]];
IO.PutF1[cmd.out, "number of screens: %g\n", IO.int[screenCount]];
IO.PutF1[cmd.out, "number of formats: %g\n", IO.int[info.numberOfFORMATs]];
};
X11CommanderOps.DoWithConnection[Inner];
};
OtherServerInfoCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
info: Xl.InfoRef ¬ Xl.Info[connection];
IO.PutF1[cmd.out, "bitmapFormatScanlineUnit: %g\n", IO.int[info.bitmapFormatScanlineUnit]];
IO.PutF1[cmd.out, "bitmapFormatScanlinePad: %g\n", IO.int[info.bitmapFormatScanlinePad]];
IO.PutF1[cmd.out, "max request length words: %g\n", IO.int[info.maxRequestLength]];
IO.PutF1[cmd.out, "max request length bytes: %g\n", IO.int[info.maxRequestLengthBytes]];
SELECT info.imageByteOrder FROM
lsbFirst => IO.PutRope[cmd.out, "imageByteOrder: lsbFirst\n"];
msbFirst => IO.PutRope[cmd.out, "imageByteOrder: msbFirst\n"];
ENDCASE => ERROR;
SELECT info.bitmapFormatBitOrder FROM
leastSignificant => IO.PutRope[cmd.out, "bitmapFormatBitOrder: leastSignificant\n"];
mostSignificant => IO.PutRope[cmd.out, "bitmapFormatBitOrder: mostSignificant\n"];
ENDCASE => ERROR;
};
X11CommanderOps.DoWithConnection[Inner];
};
doc: Rope.ROPE = "...query default X server";
Commander.Register[key: "X11ListFontsWithInfo", proc: ListFontsWithInfoCommand, doc: doc];
Commander.Register[key: "X11EnumerateFonts", proc: EnumerateFontsCommand, doc: doc];
Commander.Register[key: "X11GetFontPath", proc: GetFontPathCommand, doc: doc];
Commander.Register[key: "X11ListExtensions", proc: ListExtensionsCommand, doc: doc];
Commander.Register[key: "X11ServerInfo", proc: ServerInfoCommand, doc: doc];
Commander.Register[key: "X11MoreServerInfo", proc: OtherServerInfoCommand, doc: doc];
END.