void MitshmPutImage (FD fd, const unsigned char *buf) { PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* MitshmRequest */ ; PrintField (buf, 1, 1, MITSHMREQUEST, MITSHMREQUESTHEADER) /* MitshmSwitch */ ; if (Verbose < 1) return; if (Verbose > 1) PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 4, DRAWABLE, "drawable"); PrintField (buf, 8, 4, GCONTEXT, "gc"); PrintField (buf, 12, 2, CARD16, "total-width"); PrintField (buf, 14, 2, CARD16, "total-height"); PrintField (buf, 16, 2, CARD16, "src-x"); PrintField (buf, 18, 2, CARD16, "src-y"); PrintField (buf, 20, 2, CARD16, "src-width"); PrintField (buf, 22, 2, CARD16, "src-height"); PrintField (buf, 24, 2, INT16, "dst-x"); PrintField (buf, 26, 2, INT16, "dst-y"); PrintField (buf, 28, 1, CARD8, "depth"); PrintField (buf, 29, 1, CARD8, "format"); PrintField (buf, 30, 1, BOOL, "send-event"); PrintField (buf, 31, 1, CARD8, "bpad"); PrintField (buf, 32, 4, CARD32, "shmseg"); PrintField (buf, 36, 4, CARD32, "offset"); }
void RenderTransform (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); }
void RenderSetPictureClipRectangles (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); }
void RenderQueryPictFormats (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); }
void RenderFreePicture (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); }
void RenderQueryFilters (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, DRAWABLE, "drawable"); }
void RenderQueryPictIndexValues (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTFORMAT, "format"); }
void RenderFreeGlyphSet (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); }
void RenderSetPictureTransform (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); PrintField(buf, 8, 9 * 8, RENDERTRANSFORM, "transform"); }
void RenderQueryVersion (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, CARD32, "major-version"); PrintField(buf, 8, 4, CARD32, "minor-version"); }
void RenderCreateAnimCursor (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, CURSOR, "cursor-id"); /* Todo: print list of cursor animation elements */ }
void RenderAddGlyphsFromPicture (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); /* Todo: print list of glyphs */ }
void RenderCreateSolidFill (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); PrintField(buf, 8, 8, RENDERCOLOR, "color"); }
void RenderAddGlyphs (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); PrintField(buf, 8, 4, CARD32, "nglyphs"); PrintGlyphs(&buf[12], ILong(&buf[8]), "glyphs"); }
void MitshmQueryVersion (FD fd, const unsigned char *buf) { PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* MitshmRequest */ ; PrintField (buf, 1, 1, MITSHMREQUEST, MITSHMREQUESTHEADER) /* MitshmSwitch */ ; if (Verbose < 1) return; if (Verbose > 1) PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); }
void RenderCreateCursor (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, CURSOR, "cursor-id"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 2, CARD16, "x"); PrintField(buf, 14, 2, CARD16, "y"); }
void RenderFreeGlyphs (FD fd, const unsigned char *buf) { unsigned short n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); n = (IShort(&buf[2]) - 2); (void)PrintList(&buf[8], (long)n, CARD32, "glyphs"); }
void RenderSetPictureFilter (FD fd, const unsigned char *buf) { int n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); n = IShort(&buf[8]); PrintString8(&buf[12], n, "filter"); /* Todo: print list of optional values */ }
void RenderCreateConicalGradient (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); PrintField(buf, 8, 8, POINTFIXED, "center"); PrintField(buf, 16, 4, FIXED, "angle"); PrintField(buf, 20, 4, CARD32, "num stops"); /* Todo: print list of stops & colors for each */ }
void RenderFillRectangles (FD fd, const unsigned char *buf) { int n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 5) / 2; PrintField(buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "dest"); PrintField(buf, 12, 8, RENDERCOLOR, "color"); (void)PrintList(&buf[20], (long)n, RECTANGLE, "rectangles"); }
void RenderAddTraps (FD fd, const unsigned char *buf) { int n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "picture"); PrintField(buf, 8, 2, CARD16, "xOff"); PrintField(buf, 10, 2, CARD16, "yOff"); n = (CS[fd].requestLen - 3) / 10; PrintList(&buf[24], (long)n, TRAPEZOID, "trapezoids"); }
void MitshmAttach (FD fd, const unsigned char *buf) { PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* MitshmRequest */ ; PrintField (buf, 1, 1, MITSHMREQUEST, MITSHMREQUESTHEADER) /* MitshmSwitch */ ; if (Verbose < 1) return; if (Verbose > 1) PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, CARD32, "shmseg"); PrintField(buf, 8, 4, CARD32, "shmid"); PrintField(buf, 12, 1, BOOL, "read-only"); }
void RenderTrapezoids (FD fd, const unsigned char *buf) { int n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "dest"); PrintField(buf, 16, 4, PICTFORMAT, "mask format"); PrintField(buf, 20, 2, INT16, "source x"); PrintField(buf, 22, 2, INT16, "source y"); n = (CS[fd].requestLen - 6) / 10; PrintList(&buf[24], (long)n, TRAPEZOID, "trapezoids"); }
void RenderTriFan (FD fd, const unsigned char *buf) { long n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "dest"); PrintField(buf, 16, 4, PICTFORMAT, "mask format"); PrintField(buf, 20, 2, INT16, "source x"); PrintField(buf, 22, 2, INT16, "source y"); n = (CS[fd].requestLen - 6) / 2; PrintList(&buf[24], n, POINTFIXED, "points"); }
void RenderScale (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, PICTURE, "source"); PrintField(buf, 8, 4, PICTURE, "dest"); PrintField(buf, 12, 4, CARD32, "color scale"); PrintField(buf, 16, 4, CARD32, "alpha scale"); PrintField(buf, 20, 2, INT16, "source x"); PrintField(buf, 22, 2, INT16, "source y"); PrintField(buf, 24, 2, INT16, "dest x"); PrintField(buf, 26, 2, INT16, "dest y"); PrintField(buf, 28, 2, CARD16, "width"); PrintField(buf, 30, 2, CARD16, "height"); }
void RenderCompositeGlyphs32 (FD fd, const unsigned char *buf) { int n; RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 7) * 4; PrintField(buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "dest"); PrintField(buf, 16, 4, PICTFORMAT, "mask format"); PrintField(buf, 20, 4, GLYPHSET, "glyphset"); PrintField(buf, 24, 2, INT16, "x-src"); PrintField(buf, 26, 2, INT16, "y-src"); PrintGlyphList(&buf[28], n, "items", 4); }
void RenderComposite (FD fd, const unsigned char *buf) { RenderRequestHeader (fd, buf); if (Verbose < 1) return; printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "mask"); PrintField(buf, 16, 4, PICTURE, "dest"); PrintField(buf, 20, 2, INT16, "source x"); PrintField(buf, 22, 2, INT16, "source y"); PrintField(buf, 24, 2, INT16, "mask x"); PrintField(buf, 26, 2, INT16, "mask y"); PrintField(buf, 28, 2, INT16, "dest x"); PrintField(buf, 30, 2, INT16, "dest y"); PrintField(buf, 32, 2, CARD16, "width"); PrintField(buf, 34, 2, CARD16, "height"); }
/// @bug one can change const and ruin other's work, we need unchangable VIntConst class MXnode::MXnode(const char* aname, VStateless_class *abase): Methoded(aname?aname:"xnode", abase) { /// DOM1 node // Node insertBefore(in Node newChild,in Node refChild) raises(DOMException); add_native_method("insertBefore", Method::CT_DYNAMIC, _insertBefore, 2, 2); // Node replaceChild(in Node newChild,in Node oldChild) raises(DOMException); add_native_method("replaceChild", Method::CT_DYNAMIC, _replaceChild, 2, 2); // Node removeChild(in Node oldChild) raises(DOMException); add_native_method("removeChild", Method::CT_DYNAMIC, _removeChild, 1, 1); // Node appendChild(in Node newChild) raises(DOMException); add_native_method("appendChild", Method::CT_DYNAMIC, _appendChild, 1, 1); // boolean hasChildNodes(); add_native_method("hasChildNodes", Method::CT_DYNAMIC, _hasChildNodes, 0, 0); // Node cloneNode(in boolean deep); add_native_method("cloneNode", Method::CT_DYNAMIC, _cloneNode, 1, 1); /// DOM1 element // DOMString getAttribute(in DOMString name); add_native_method("getAttribute", Method::CT_DYNAMIC, _getAttribute, 1, 1); // void setAttribute(in DOMString name, in DOMString value) raises(DOMException); add_native_method("setAttribute", Method::CT_DYNAMIC, _setAttribute, 2, 2); // void removeAttribute(in DOMString name) raises(DOMException); add_native_method("removeAttribute", Method::CT_DYNAMIC, _removeAttribute, 1, 1); // Attr getAttributeNode(in DOMString name); add_native_method("getAttributeNode", Method::CT_DYNAMIC, _getAttributeNode, 1, 1); // Attr setAttributeNode(in Attr newAttr) raises(DOMException); add_native_method("setAttributeNode", Method::CT_DYNAMIC, _setAttributeNode, 1, 1); // Attr removeAttributeNode(in Attr oldAttr) raises(DOMException); add_native_method("removeAttributeNode", Method::CT_DYNAMIC, _removeAttributeNode, 1, 1); // NodeList getElementsByTagName(in DOMString name); add_native_method("getElementsByTagName", Method::CT_DYNAMIC, _getElementsByTagName, 1, 1); // NodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName); add_native_method("getElementsByTagNameNS", Method::CT_DYNAMIC, _getElementsByTagNameNS, 2, 2); // void normalize(); add_native_method("normalize", Method::CT_DYNAMIC, _normalize, 0, 0); /// DOM2 element // DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName); add_native_method("getAttributeNS", Method::CT_DYNAMIC, _getAttributeNS, 2, 2); // void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException); add_native_method("setAttributeNS", Method::CT_DYNAMIC, _setAttributeNS, 3, 3); // void removeAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); add_native_method("removeAttributeNS", Method::CT_DYNAMIC, _removeAttributeNS, 2, 2); // Attr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName); add_native_method("getAttributeNodeNS", Method::CT_DYNAMIC, _getAttributeNodeNS, 2, 2); // Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException); add_native_method("setAttributeNodeNS", Method::CT_DYNAMIC, _setAttributeNode, 1, 1); // boolean hasAttribute(in DOMString name) raises(DOMException); add_native_method("hasAttribute", Method::CT_DYNAMIC, _hasAttribute, 1, 1); // boolean hasAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); add_native_method("hasAttributeNS", Method::CT_DYNAMIC, _hasAttributeNS, 2, 2); // boolean hasAttributes add_native_method("hasAttributes", Method::CT_DYNAMIC, _hasAttributes, 0, 0); /// parser // ^node.select[/some/xpath/query] = hash $.#[dnode] add_native_method("select", Method::CT_DYNAMIC, _select, 1, 1); // ^node.selectSingle[/some/xpath/query] = first node [if any] add_native_method("selectSingle", Method::CT_DYNAMIC, _selectSingle, 1, 1); // ^node.selectBool[/some/xpath/query] = bool value [if any] add_native_method("selectBool", Method::CT_DYNAMIC, _selectBool, 1, 1); // ^node.selectNumber[/some/xpath/query] = double value [if any] add_native_method("selectNumber", Method::CT_DYNAMIC, _selectNumber, 1, 1); // ^node.selectString[/some/xpath/query] = strinv value [if any] add_native_method("selectString", Method::CT_DYNAMIC, _selectString, 1, 1); // consts #define CONST(name) \ consts.put(String::Body(#name), new VInt(XML_##name)) #define CONST2(name, value) \ consts.put(String::Body(#name), new VInt(value)) CONST(ELEMENT_NODE); CONST(ATTRIBUTE_NODE); CONST(TEXT_NODE); CONST(CDATA_SECTION_NODE); CONST2(ENTITY_REFERENCE_NODE, XML_ENTITY_REF_NODE); CONST(ENTITY_NODE); CONST2(PROCESSING_INSTRUCTION_NODE, XML_PI_NODE); CONST(COMMENT_NODE); CONST(DOCUMENT_NODE); CONST(DOCUMENT_TYPE_NODE); CONST2(DOCUMENT_FRAGMENT_NODE, XML_DOCUMENT_FRAG_NODE); CONST(NOTATION_NODE); }