diff options
author | Jamey Sharp <jamey@minilop.net> | 2003-03-27 02:06:46 +0000 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2003-03-27 02:06:46 +0000 |
commit | fb1178b51075823f973a702bc3e4a71230171f68 (patch) | |
tree | 2f72f6b9186625267a63136fc9961fdbbd61bb8b /xcl | |
parent | 8b554726a1318496c259512f248def857575fd25 (diff) |
Extended XCL macro language; replaced some more source files with proto.m4.
Diffstat (limited to 'xcl')
-rw-r--r-- | xcl/src/proto.m4 | 34 | ||||
-rw-r--r-- | xcl/src/xcbwrap.m4 | 63 |
2 files changed, 68 insertions, 29 deletions
diff --git a/xcl/src/proto.m4 b/xcl/src/proto.m4 index 7bbe564..893f4ed 100644 --- a/xcl/src/proto.m4 +++ b/xcl/src/proto.m4 @@ -83,3 +83,37 @@ XCLREQ(UnmapSubwindows, XCLPARAMS(Window window)) XCLREQ(UnmapWindow, XCLPARAMS(Window window)) XCLREQ(WarpPointer, XCLPARAMS(Window src_window, Window dst_window, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dst_x, int dst_y)) + +XCLREQ(UnloadFont, XCLCALL(CloseFont), XCLPARAMS(Font font)) + +XCLREQ(ResizeWindow, XCLCALL(ConfigureWindow), XCLPARAMS(Window window, unsigned int width, unsigned int height), +XCLLOCAL(`CARD16 value_mask = CWWidth | CWHeight'), XCLLOCAL(`CARD32 value_list[] = { width, height }')) + +XCLREQ(MoveResizeWindow, XCLCALL(ConfigureWindow), XCLPARAMS(Window window, int x, int y, unsigned int width, unsigned int height), +XCLLOCAL(`CARD16 value_mask = CWX | CWY | CWWidth | CWHeight'), XCLLOCAL(`CARD32 value_list[] = { x, y, width, height }')) + +XCLREQ(MoveWindow, XCLCALL(ConfigureWindow), XCLPARAMS(Window window, int x, int y), +XCLLOCAL(`CARD16 value_mask = CWX | CWY'), XCLLOCAL(`CARD32 value_list[] = { x, y }')) + +XCLREQ(SetWindowBackground, XCLCALL(ChangeWindowAttributes), XCLPARAMS(Window window, unsigned long pixel), +XCLLOCAL(`CARD16 value_mask = CWBackPixel'), XCLLOCAL(`CARD32 value_list[] = { pixel }')) + +XCLREQ(SetWindowBackgroundPixmap, XCLCALL(ChangeWindowAttributes), XCLPARAMS(Window window, Pixmap pixmap), +XCLLOCAL(`CARD16 value_mask = CWBackPixmap'), XCLLOCAL(`CARD32 value_list[] = { pixmap }')) + +XCLREQ(DefineCursor, XCLCALL(ChangeWindowAttributes), XCLPARAMS(Window window, Cursor cursor), +XCLLOCAL(`CARD16 value_mask = CWCursor'), XCLLOCAL(`CARD32 value_list[] = { cursor }')) + +XCLREQ(SelectInput, XCLCALL(ChangeWindowAttributes), XCLPARAMS(Window window, long mask), +XCLLOCAL(`CARD16 value_mask = XCBCWEventMask'), XCLLOCAL(`CARD32 value_list[] = { mask }')) + +XCLREQ(ClearWindow, XCLCALL(ClearArea), XCLPARAMS(Window window), +XCLLOCAL(`BOOL exposures = 0'), XCLLOCAL(`INT16 x = 0, y = 0'), XCLLOCAL(`CARD16 width = 0, height = 0')) + +XCLREQ(FillPolygon, XCLCALL(FillPoly), XCLGC(gc), XCLPARAMS(Drawable drawable, GC gc, XPoint *points, int points_len, int shape, int coordinate_mode)) + +XCLREQ(DrawLine, XCLCALL(PolySegment), XCLGC(gc), XCLPARAMS(Drawable drawable, GC gc, int x1, int y1, int x2, int y2), +XCLLOCAL(`CARD16 segments_len = 1'), XCLLOCAL(`SEGMENT segments[] = { { x1, y1, x2, y2 } }')) + +XCLREQ(DrawPoint, XCLCALL(PolyPoint), XCLGC(gc), XCLPARAMS(Drawable drawable, GC gc, int x, int y), +XCLLOCAL(`BYTE coordinate_mode = CoordModeOrigin'), XCLLOCAL(`CARD16 points_len = 1'), XCLLOCAL(`POINT points[] = { { x, y } }')) diff --git a/xcl/src/xcbwrap.m4 b/xcl/src/xcbwrap.m4 index 961371b..0530381 100644 --- a/xcl/src/xcbwrap.m4 +++ b/xcl/src/xcbwrap.m4 @@ -9,46 +9,44 @@ dnl All Rights Reserved. See the file COPYING for licensing information. divert(-1) dnl kill output until the next diversion dnl default values -define(`DEFRETTYPE', `int') -define(`DEFRETVAL', `1') -define(`DEFPARAMS', `') -define(`DEFFLUSHGC', `') -define(`DEFALLOC', `') - -dnl init to defaults -define(`RETTYPE', DEFRETTYPE) -define(`RETVAL', DEFRETVAL) -define(`PARAMS', DEFPARAMS) -define(`FLUSHGC', DEFFLUSHGC) -define(`ALLOC', DEFALLOC) +define(`SETDEFAULTS', ` + define(`CALL', `') + define(`RETTYPE', `int') + define(`RETVAL', `1') + define(`PARAMS', `') + define(`FLUSHGC', `') + define(`LOCALS', `') +') +SETDEFAULTS() dnl XCLREQ(name, specs ...) define(`XCLREQ', ` dnl evaluate anything that the caller passed in shift($@) +ifelse(CALL, , `define(`CALL', $1)') dnl save values into their per-request storage +define(CALL`CALLERS', `$1, 'defn(CALL`CALLERS')) define(`$1'`RETTYPE', RETTYPE) define(`$1'`RETVAL', RETVAL) define(`$1'`PARAMS', defn(`PARAMS')) define(`$1'`FLUSHGC', FLUSHGC) -define(`$1'`ALLOC', ALLOC) +define(`$1'`LOCALS', LOCALS) dnl restore defaults for next round -define(`RETTYPE', DEFRETTYPE) -define(`RETVAL', DEFRETVAL) -define(`PARAMS', DEFPARAMS) -define(`FLUSHGC', DEFFLUSHGC) -define(`ALLOC', DEFALLOC) +SETDEFAULTS() ') +define(`XCLCALL', `define(`CALL', `$1')') define(`XCLRETTYPE', `define(`RETTYPE', `$1')') define(`XCLRETVAL', `define(`RETVAL', `$1')') define(`XCLPARAMS', `define(`PARAMS', `,$@')') define(`XCLGC', `define(`FLUSHGC', `$1')') +define(`XCLLOCAL', `define(`LOCALS', defn(`LOCALS')` + const `$1';') +') -define(`XCLALLOC', `define(`ALLOC', ` - $1 $2 = XCB`'dnl +define(`XCLALLOC', `XCLLOCAL(`$1 $2 = XCB`'dnl ifelse($1, `Window', `WINDOW', ifelse($1, `Pixmap', `PIXMAP', ifelse($1, `Cursor', `CURSOR', @@ -56,32 +54,39 @@ ifelse($1, `Font', `FONT', ifelse($1, `GContext', `GCONTEXT', ifelse($1, `Colormap', `COLORMAP', ifelse($1, `Atom', `ATOM')))))))`'dnl -New(c).xid;') +New(c).xid') define(`RETTYPE', `$1') define(`RETVAL', `$2') ') - -dnl Implementations of XCB request description macros - -define(`VOIDREQUEST', `divert(0)ifdef(`$1'`RETTYPE', ` +dnl XCLFUNC(Xlib name, XCB name, XCB args) +define(`XCLFUNC', `divert(0) $1RETTYPE X`'$1(Display *dpy`'$1PARAMS) { register XCBConnection *c = XCBConnectionOfDisplay(dpy);dnl -$1ALLOC +$1LOCALS ifelse($1FLUSHGC, , , `dnl LockDisplay(dpy); FlushGC(dpy, $1FLUSHGC); ')dnl - XCB$1(c`'divert(-1) - $2 + XCB$2(c`'divert(-1) + $3 divert(0)); ifelse($1FLUSHGC, , , `dnl UnlockDisplay(dpy); ')dnl return $1RETVAL; } -')divert(-1)') +divert(-1)') + +define(`XCLFUNCS', `ifelse($2, , , +`XCLFUNC($2, $1) XCLFUNCS(`$1', shift(shift($@)))' +)') + + +dnl Implementations of XCB request description macros + +define(`VOIDREQUEST', `ifdef(`$1'`CALLERS', `XCLFUNCS(`$@', $1CALLERS)')') define(`PARAM', `divert(0), dnl ifelse($1, `WINDOW', `XCLWINDOW($2)', |