PreviousUpNext

15.4.1607  src/lib/x-kit/xclient/src/to-string/xerror-to-string.pkg

## xerror-to-string.pkg

# Compiled by:
#     src/lib/x-kit/xclient/xclient-internals.sublib


stipulate
    package xe = xerrors;                       # xerrors       is from   src/lib/x-kit/xclient/src/wire/xerrors.pkg
    package xt = xtypes;                        # xtypes        is from   src/lib/x-kit/xclient/src/wire/xtypes.pkg
herein

    api Xerror_To_String {
        xerror_kind_to_string:   xe::Xerror_Kind -> String;
        xerror_to_string:        xe::Xerror      -> String;
    };



    package   xerror_to_string
    : (weak)  Xerror_To_String
    {
        fun req_code_to_string (0u1:  one_byte_unt::Unt) => "CreateWindow";
            req_code_to_string 0u2 => "ChangeWindowAttributes";
            req_code_to_string 0u3 => "GetWindowAttributes";
            req_code_to_string 0u4 => "DestroyWindow";
            req_code_to_string 0u5 => "DestroySubwindows";
            req_code_to_string 0u6 => "ChangeSaveSet";
            req_code_to_string 0u7 => "ReparentWindow";
            req_code_to_string 0u8 => "MapWindow";
            req_code_to_string 0u9 => "MapSubwindows";
            req_code_to_string 0u10 => "UnmapWindow";
            req_code_to_string 0u11 => "UnmapSubwindows";
            req_code_to_string 0u12 => "ConfigureWindow";
            req_code_to_string 0u13 => "CirculateWindow";
            req_code_to_string 0u14 => "GetGeometry";
            req_code_to_string 0u15 => "QueryTree";
            req_code_to_string 0u16 => "InternAtom";
            req_code_to_string 0u17 => "GetAtomName";
            req_code_to_string 0u18 => "ChangeProperty";
            req_code_to_string 0u19 => "DeleteProperty";
            req_code_to_string 0u20 => "GetProperty";
            req_code_to_string 0u21 => "ListProperties";
            req_code_to_string 0u22 => "SetSelectionOwner";
            req_code_to_string 0u23 => "GetSelectionOwner";
            req_code_to_string 0u24 => "ConvertSelection";
            req_code_to_string 0u25 => "SendEvent";
            req_code_to_string 0u26 => "GrabPointer";
            req_code_to_string 0u27 => "UngrabPointer";
            req_code_to_string 0u28 => "GrabButton";
            req_code_to_string 0u29 => "UngrabButton";
            req_code_to_string 0u30 => "ChangeActivePointerGrab";
            req_code_to_string 0u31 => "GrabKeyboard";
            req_code_to_string 0u32 => "UngrabKeyboard";
            req_code_to_string 0u33 => "GrabKey";
            req_code_to_string 0u34 => "UngrabKey";
            req_code_to_string 0u35 => "AllowEvents";
            req_code_to_string 0u36 => "GrabServer";
            req_code_to_string 0u37 => "UngrabServer";
            req_code_to_string 0u38 => "QueryPointer";
            req_code_to_string 0u39 => "GetMotionEvents";
            req_code_to_string 0u40 => "TranslateCoords";
            req_code_to_string 0u41 => "WarpPointer";
            req_code_to_string 0u42 => "SetInputFocus";
            req_code_to_string 0u43 => "GetInputFocus";
            req_code_to_string 0u44 => "QueryKeymap";
            req_code_to_string 0u45 => "OpenFont";
            req_code_to_string 0u46 => "CloseFont";
            req_code_to_string 0u47 => "QueryFont";
            req_code_to_string 0u48 => "QueryTextExtents";
            req_code_to_string 0u49 => "ListFonts";
            req_code_to_string 0u50 => "ListFontsWithInfo";
            req_code_to_string 0u51 => "SetFontPath";
            req_code_to_string 0u52 => "GetFontPath";
            req_code_to_string 0u53 => "CreatePixmap";
            req_code_to_string 0u54 => "FreePixmap";
            req_code_to_string 0u55 => "CreateGC";
            req_code_to_string 0u56 => "ChangeGC";
            req_code_to_string 0u57 => "CopyGC";
            req_code_to_string 0u58 => "SetDashes";
            req_code_to_string 0u59 => "SetClipRectangles";
            req_code_to_string 0u60 => "FreeGC";
            req_code_to_string 0u61 => "ClearArea";
            req_code_to_string 0u62 => "CopyArea";
            req_code_to_string 0u63 => "CopyPlane";
            req_code_to_string 0u64 => "PolyPoint ";
            req_code_to_string 0u65 => "PolyLine";
            req_code_to_string 0u66 => "PolySegment";
            req_code_to_string 0u67 => "PolyRectangle";
            req_code_to_string 0u68 => "PolyArc";
            req_code_to_string 0u69 => "FillPoly";
            req_code_to_string 0u70 => "PolyFillRectangle";
            req_code_to_string 0u71 => "PolyFillArc";
            req_code_to_string 0u72 => "PutImage";
            req_code_to_string 0u73 => "GetImage";
            req_code_to_string 0u74 => "PolyText8";
            req_code_to_string 0u75 => "PolyText16";
            req_code_to_string 0u76 => "ImageText8";
            req_code_to_string 0u77 => "ImageText16";
            req_code_to_string 0u78 => "CreateColormap";
            req_code_to_string 0u79 => "FreeColormap";
            req_code_to_string 0u80 => "CopyColormapAndFree";
            req_code_to_string 0u81 => "InstallColormap";
            req_code_to_string 0u82 => "UninstallColormap";
            req_code_to_string 0u83 => "ListInstalledColormaps";
            req_code_to_string 0u84 => "AllocColor";
            req_code_to_string 0u85 => "AllocNamedColor";
            req_code_to_string 0u86 => "AllocColorCells";
            req_code_to_string 0u87 => "AllocColorPlanes";
            req_code_to_string 0u88 => "FreeColors";
            req_code_to_string 0u89 => "StoreColors";
            req_code_to_string 0u90 => "StoreNamedColor";
            req_code_to_string 0u91 => "QueryColors";
            req_code_to_string 0u92 => "LookupColor";
            req_code_to_string 0u93 => "CreateCursor";
            req_code_to_string 0u94 => "CreateGlyphCursor";
            req_code_to_string 0u95 => "FreeCursor";
            req_code_to_string 0u96 => "RecolorCursor";
            req_code_to_string 0u97 => "QueryBestSize";
            req_code_to_string 0u98 => "QueryExtension";
            req_code_to_string 0u99 => "ListExtensions";
            req_code_to_string 0u100 => "ChangeKeyboardMapping";
            req_code_to_string 0u101 => "GetKeyboardMapping";
            req_code_to_string 0u102 => "ChangeKeyboardControl";
            req_code_to_string 0u103 => "GetKeyboardControl";
            req_code_to_string 0u104 => "Bell";
            req_code_to_string 0u105 => "ChangePointerControl";
            req_code_to_string 0u106 => "GetPointerControl";
            req_code_to_string 0u107 => "SetScreenSaver";
            req_code_to_string 0u108 => "GetScreenSaver";
            req_code_to_string 0u109 => "ChangeHosts";
            req_code_to_string 0u110 => "ListHosts";
            req_code_to_string 0u111 => "SetAccessControl";
            req_code_to_string 0u112 => "SetCloseDownMode";
            req_code_to_string 0u113 => "KillClient";
            req_code_to_string 0u114 => "RotateProperties";
            req_code_to_string 0u115 => "ForceScreenSaver";
            req_code_to_string 0u116 => "SetPointerMapping";
            req_code_to_string 0u117 => "GetPointerMapping";
            req_code_to_string 0u118 => "SetModifierMapping";
            req_code_to_string 0u119 => "GetModifierMapping";
            req_code_to_string 0u127 => "NoOperation";
            req_code_to_string w => string::cat ["CODE=", one_byte_unt::to_string w];
        end;

        stipulate
            xid_to_string = xt::xid_to_string;
        herein

            fun xerror_kind_to_string  xe::BAD_REQUEST => "BadRequest";
                xerror_kind_to_string (xe::BAD_VALUE v) => ("BadValue " + v);
                xerror_kind_to_string (xe::BAD_WINDOW xid) => ("BadWindow " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_PIXMAP xid) => ("BadPixmap " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_ATOM xid) => ("BadAtom " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_CURSOR xid) => ("BadCursor " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_FONT xid) => ("BadFont " + xid_to_string xid);
                xerror_kind_to_string  xe::BAD_MATCH => "BadMatch";
                xerror_kind_to_string (xe::BAD_DRAWABLE xid) => ("BadDrawable " + xid_to_string xid);
                xerror_kind_to_string  xe::BAD_ACCESS => "BadAccess";
                xerror_kind_to_string  xe::BAD_ALLOC => "BadAlloc";
                xerror_kind_to_string (xe::BAD_COLOR xid) => ("BadColor " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_GC xid) => ("BadGC " + xid_to_string xid);
                xerror_kind_to_string (xe::BAD_IDCHOICE xid) => ("BadIDChoice " + xid_to_string xid);
                xerror_kind_to_string  xe::BAD_NAME => "BAD_NAME";
                xerror_kind_to_string  xe::BAD_LENGTH => "BadLength";
                xerror_kind_to_string  xe::BAD_IMPLEMENTATION => "BadImplementation";
            end;

        end;

        fun xerror_to_string (xe::XERROR { kind, major_op, minor_op } )
            =
            string::cat
              [
                "<<",          xerror_kind_to_string   kind,
                ", major = ",  req_code_to_string      major_op,
                ", minor = ",  unt::to_string          minor_op,
                ">>"
              ];


    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext